home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgp263.arj / PGP263I.SRC / PGP263II.ZIP / src / fileio.h < prev    next >
C/C++ Source or Header  |  1996-01-06  |  5KB  |  169 lines

  1. #define DISKBUFSIZE 4096    /* Size of I/O buffers */
  2.  
  3. #ifndef SEEK_SET
  4. #define SEEK_SET 0
  5. #define    SEEK_CUR 1
  6. #define SEEK_END 2
  7. #endif
  8.  
  9. #ifdef VMS
  10. #define PGP_SYSTEM_DIR "PGP$LIBRARY:"
  11. #define FOPRBIN        "rb","ctx=stm"
  12. #define FOPRTXT        "r"
  13. #if 0
  14. #define FOPWBIN        "ab","fop=cif"
  15. #define FOPWTXT        "a","fop=cif"
  16. #else
  17. #define FOPWBIN        "wb"
  18. #define FOPWTXT        "w"
  19. #endif
  20. #define FOPRWBIN    "r+b","ctx=stm"
  21. #define FOPWPBIN    "w+b","ctx=stm"
  22. #else
  23. #ifdef UNIX
  24. /*
  25.  * Directory for system-wide files.  Must end in a /, ready for
  26.  * dumb appending of the filename.  (If not defined, it's not used.)
  27.  */
  28. #ifdef LINUX
  29. #  define PGP_SYSTEM_DIR "/var/lib/pgp/"
  30. #else
  31. #  define PGP_SYSTEM_DIR "/usr/local/lib/pgp/"
  32. #endif
  33. #define FOPRBIN        "r"
  34. #define FOPRTXT        "r"
  35. #define FOPWBIN        "w"
  36. #define FOPWTXT        "w"
  37. #define FOPRWBIN    "r+"
  38. #define FOPWPBIN    "w+"
  39. #else /* !UNIX && !VMS */
  40. #define FOPRBIN        "rb"
  41. #define FOPRTXT        "r"
  42. #define FOPWBIN        "wb"
  43. #define FOPWTXT        "w"
  44. #define FOPRWBIN    "r+b"
  45. #define FOPWPBIN    "w+b"
  46. #endif /* UNIX */
  47. #endif /* VMS */
  48.  
  49. #define    TMP_WIPE        1
  50. #define    TMP_TMPDIR        4
  51.  
  52. #define equal_buffers(buf1,buf2,count)    !memcmp( buf1, buf2, count )
  53.  
  54. /* Returns TRUE iff file is can be opened for reading. */
  55. boolean file_exists(char *filename);
  56.  
  57. /* Returns TRUE iff file can be opened for writing. Does not harm file! */
  58. boolean file_ok_write(char *filename);
  59.  
  60. /* Completely overwrite and erase file of given name, so that no sensitive
  61.    information is left on the disk */
  62. int wipefile(char *filename);
  63.  
  64. /* Return the after-slash part of the filename */
  65. char    *file_tail (char *filename);
  66. /* Returns TRUE if user left off file extension, allowing default */
  67. boolean no_extension(char *filename);
  68.  
  69. /* Deletes trailing ".xxx" file extension after the period */
  70. void drop_extension(char *filename);
  71.  
  72. /* Append filename extension if there isn't one already */
  73. void default_extension(char *filename, char *extension);
  74.  
  75. /* Change the filename extension */
  76. void force_extension(char *filename, char *extension);
  77.  
  78. /* Get yes/no answer from user, returns TRUE for yes, FALSE for no */
  79. boolean getyesno(char default_answer);
  80.  
  81. /* If luser consents to it, change the filename extension */
  82. char *maybe_force_extension(char *filename, char *extension);
  83.  
  84. /* Builds a filename with a complete path specifier from the environmental
  85.    variable PGPPATH */
  86. char *buildfilename(char *result, char *fname);
  87.  
  88. /* The same, but also searches PGP_SYETEM_DIR */
  89. char *buildsysfilename(char *result, char *fname);
  90.  
  91. /* Build a path for fileName based on origPath */
  92. int build_path(char *path, char *fileName, char *origPath);
  93.  
  94. /* Convert filename to canonical form, with slashes as separators */
  95. void file_to_canon(char *filename);
  96.  
  97. /* Convert filename from canonical to local form */
  98. void file_from_canon(char *filename);
  99.  
  100. /* Copy file f to file g, for longcount bytes */
  101. int copyfile(FILE *f, FILE *g, word32 longcount);
  102.  
  103. /* Copy file f to file g, for longcount bytes, positioning f at fpos */
  104. int copyfilepos (FILE *f, FILE *g, word32 longcount, word32 fpos);
  105.  
  106. /* Copy file f to file g, for longcount bytes.  Convert to canonical form
  107.    as we go.  f is open in text mode.  Canonical form uses crlf's as line
  108.    separators */
  109. int copyfile_to_canon (FILE *f, FILE *g, word32 longcount);
  110.  
  111. /* Copy file f to file g, for longcount bytes.  Convert from canonical to
  112.    local form as we go.  g is open in text mode.  Canonical form uses crlf's
  113.    as line separators */
  114. int copyfile_from_canon (FILE *f, FILE *g, word32 longcount);
  115.  
  116. /* Copy srcFile to destFile */
  117. int copyfiles_by_name(char *srcFile, char *destFile);
  118.  
  119. /* Copy srcFile to destFile, converting to canonical text form */
  120. int make_canonical(char *srcFile, char *destFile);
  121.  
  122. /* Like rename() but will try to copy the file if the rename fails. This is
  123.    because under OS's with multiple physical volumes if the source and
  124.    destination are on different volumes the rename will fail */
  125. int rename2(char *srcFile, char *destFile);
  126.  
  127. /* Read the data from stdin to the phantom input file */
  128. int readPhantomInput(char *filename);
  129.  
  130. /* Write the data from the phantom output file to stdout */
  131. int writePhantomOutput(char *filename);
  132.  
  133. /* Return the size from the current position of file f to the end */
  134. word32 fsize (FILE *f);
  135.  
  136. /* Return TRUE if file filename is a text file */
  137. int is_text_file (char *filename);
  138.  
  139. FILE *fopenbin(char *, char *);
  140. FILE *fopentxt(char *, char *);
  141.  
  142. VOID *xmalloc(unsigned);
  143.  
  144. char *tempfile(int);
  145. void rmtemp(char *);
  146. char *savetemp(char *, char *);
  147. char *ck_dup_output(char *, boolean, boolean);
  148. void cleanup_tmpf(void);
  149. int savetempbak(char *, char *);
  150.  
  151. extern int write_error(FILE *f);
  152. extern void settmpdir(char *path);
  153. extern void setoutdir(char *filename);
  154. extern boolean is_tempfile(char *path);
  155. extern boolean has_extension(char *filename, char *extension);
  156.  
  157. /* Directories to search for the manuals */
  158. extern char const * const manual_dirs[];
  159. /* Returns non-zero if any manuals are missing */
  160. unsigned manuals_missing(void);
  161.  
  162. #ifdef __PUREC__
  163. int access(const char *name,int flag);
  164. #endif
  165.  
  166. #ifdef MACTC5
  167. void mac_cleanup_tmpf(void);
  168. #endif
  169.