--- pgp/src/fileio.h 2018/04/24 16:37:53 1.1 +++ pgp/src/fileio.h 2018/04/24 16:41:12 1.1.1.5 @@ -6,26 +6,53 @@ #define SEEK_END 2 #endif +#ifdef VMS +#define PGP_SYSTEM_DIR "PGP$LIBRARY:" +#define FOPRBIN "rb","ctx=stm" +#define FOPRTXT "r" +#if 0 +#define FOPWBIN "ab","fop=cif" +#define FOPWTXT "a","fop=cif" +#else +#define FOPWBIN "wb" +#define FOPWTXT "w" +#endif +#define FOPRWBIN "r+b","ctx=stm" +#define FOPWPBIN "w+b","ctx=stm" +#else +#ifdef UNIX +/* + * Directory for system-wide files. Must end in a /, ready for + * dumb appending of the filename. (If not defined, it's not used.) + */ +#define PGP_SYSTEM_DIR "/usr/local/lib/pgp/" +#define FOPRBIN "r" +#define FOPRTXT "r" +#define FOPWBIN "w" +#define FOPWTXT "w" +#define FOPRWBIN "r+" +#define FOPWPBIN "w+" +#else /* !UNIX && !VMS */ +#define FOPRBIN "rb" +#define FOPRTXT "r" +#define FOPWBIN "wb" +#define FOPWTXT "w" +#define FOPRWBIN "r+b" +#define FOPWPBIN "w+b" +#endif /* UNIX */ +#endif /* VMS */ #define TMP_WIPE 1 #define TMP_TMPDIR 4 #define equal_buffers(buf1,buf2,count) !memcmp( buf1, buf2, count ) -/* This macro is for burning sensitive data (byte arrays only) on stack. - Many of the file I/O routines use it for zapping buffers */ -#define burn(x) fill0(x,sizeof(x)) - /* Returns TRUE iff file is can be opened for reading. */ boolean file_exists(char *filename); /* Returns TRUE iff file can be opened for writing. Does not harm file! */ boolean file_ok_write(char *filename); -/* Completely overwrite and erase file, so that no sensitive information is - left on the disk */ -int wipeout(FILE *f); - /* Completely overwrite and erase file of given name, so that no sensitive information is left on the disk */ int wipefile(char *filename); @@ -48,12 +75,15 @@ void force_extension(char *filename, cha boolean getyesno(char default_answer); /* If luser consents to it, change the filename extension */ -void maybe_force_extension(char *filename, char *extension); +char *maybe_force_extension(char *filename, char *extension); /* Builds a filename with a complete path specifier from the environmental variable PGPPATH */ char *buildfilename(char *result, char *fname); +/* The same, but also searches PGP_SYETEM_DIR */ +char *buildsysfilename(char *result, char *fname); + /* Build a path for fileName based on origPath */ int build_path(char *path, char *fileName, char *origPath); @@ -94,7 +124,7 @@ int rename2(char *srcFile, char *destFil int readPhantomInput(char *filename); /* Write the data from the phantom output file to stdout */ -void writePhantomOutput(char *filename); +int writePhantomOutput(char *filename); /* Return the size from the current position of file f to the end */ word32 fsize (FILE *f); @@ -105,10 +135,21 @@ int is_text_file (char *filename); FILE *fopenbin(char *, char *); FILE *fopentxt(char *, char *); -void *xmalloc(unsigned); +VOID *xmalloc(unsigned); char *tempfile(int); void rmtemp(char *); char *savetemp(char *, char *); void cleanup_tmpf(void); int savetempbak(char *, char *); + +extern int write_error(FILE *f); +extern void settmpdir(char *path); +extern void setoutdir(char *filename); +extern boolean is_tempfile(char *path); +extern boolean has_extension(char *filename, char *extension); + +/* Directories to search for the manuals */ +extern char const * const manual_dirs[]; +/* Returns non-zero if any manuals are missing */ +unsigned manuals_missing(void);