|
|
1.1.1.5 ! root 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: #define PGP_SYSTEM_DIR "/usr/local/lib/pgp/" ! 29: #define FOPRBIN "r" ! 30: #define FOPRTXT "r" ! 31: #define FOPWBIN "w" ! 32: #define FOPWTXT "w" ! 33: #define FOPRWBIN "r+" ! 34: #define FOPWPBIN "w+" ! 35: #else /* !UNIX && !VMS */ ! 36: #define FOPRBIN "rb" ! 37: #define FOPRTXT "r" ! 38: #define FOPWBIN "wb" ! 39: #define FOPWTXT "w" ! 40: #define FOPRWBIN "r+b" ! 41: #define FOPWPBIN "w+b" ! 42: #endif /* UNIX */ ! 43: #endif /* VMS */ ! 44: ! 45: #define TMP_WIPE 1 ! 46: #define TMP_TMPDIR 4 ! 47: ! 48: #define equal_buffers(buf1,buf2,count) !memcmp( buf1, buf2, count ) ! 49: ! 50: /* Returns TRUE iff file is can be opened for reading. */ ! 51: boolean file_exists(char *filename); ! 52: ! 53: /* Returns TRUE iff file can be opened for writing. Does not harm file! */ ! 54: boolean file_ok_write(char *filename); ! 55: ! 56: /* Completely overwrite and erase file of given name, so that no sensitive ! 57: information is left on the disk */ ! 58: int wipefile(char *filename); ! 59: ! 60: /* Return the after-slash part of the filename */ ! 61: char *file_tail (char *filename); ! 62: /* Returns TRUE if user left off file extension, allowing default */ ! 63: boolean no_extension(char *filename); ! 64: ! 65: /* Deletes trailing ".xxx" file extension after the period */ ! 66: void drop_extension(char *filename); ! 67: ! 68: /* Append filename extension if there isn't one already */ ! 69: void default_extension(char *filename, char *extension); ! 70: ! 71: /* Change the filename extension */ ! 72: void force_extension(char *filename, char *extension); ! 73: ! 74: /* Get yes/no answer from user, returns TRUE for yes, FALSE for no */ ! 75: boolean getyesno(char default_answer); ! 76: ! 77: /* If luser consents to it, change the filename extension */ ! 78: char *maybe_force_extension(char *filename, char *extension); ! 79: ! 80: /* Builds a filename with a complete path specifier from the environmental ! 81: variable PGPPATH */ ! 82: char *buildfilename(char *result, char *fname); ! 83: ! 84: /* The same, but also searches PGP_SYETEM_DIR */ ! 85: char *buildsysfilename(char *result, char *fname); ! 86: ! 87: /* Build a path for fileName based on origPath */ ! 88: int build_path(char *path, char *fileName, char *origPath); ! 89: ! 90: /* Convert filename to canonical form, with slashes as separators */ ! 91: void file_to_canon(char *filename); ! 92: ! 93: /* Convert filename from canonical to local form */ ! 94: void file_from_canon(char *filename); ! 95: ! 96: /* Copy file f to file g, for longcount bytes */ ! 97: int copyfile(FILE *f, FILE *g, word32 longcount); ! 98: ! 99: /* Copy file f to file g, for longcount bytes, positioning f at fpos */ ! 100: int copyfilepos (FILE *f, FILE *g, word32 longcount, word32 fpos); ! 101: ! 102: /* Copy file f to file g, for longcount bytes. Convert to canonical form ! 103: as we go. f is open in text mode. Canonical form uses crlf's as line ! 104: separators */ ! 105: int copyfile_to_canon (FILE *f, FILE *g, word32 longcount); ! 106: ! 107: /* Copy file f to file g, for longcount bytes. Convert from canonical to ! 108: local form as we go. g is open in text mode. Canonical form uses crlf's ! 109: as line separators */ ! 110: int copyfile_from_canon (FILE *f, FILE *g, word32 longcount); ! 111: ! 112: /* Copy srcFile to destFile */ ! 113: int copyfiles_by_name(char *srcFile, char *destFile); ! 114: ! 115: /* Copy srcFile to destFile, converting to canonical text form */ ! 116: int make_canonical(char *srcFile, char *destFile); ! 117: ! 118: /* Like rename() but will try to copy the file if the rename fails. This is ! 119: because under OS's with multiple physical volumes if the source and ! 120: destination are on different volumes the rename will fail */ ! 121: int rename2(char *srcFile, char *destFile); ! 122: ! 123: /* Read the data from stdin to the phantom input file */ ! 124: int readPhantomInput(char *filename); ! 125: ! 126: /* Write the data from the phantom output file to stdout */ ! 127: int writePhantomOutput(char *filename); ! 128: ! 129: /* Return the size from the current position of file f to the end */ ! 130: word32 fsize (FILE *f); ! 131: ! 132: /* Return TRUE if file filename is a text file */ ! 133: int is_text_file (char *filename); ! 134: ! 135: FILE *fopenbin(char *, char *); ! 136: FILE *fopentxt(char *, char *); ! 137: ! 138: VOID *xmalloc(unsigned); ! 139: ! 140: char *tempfile(int); ! 141: void rmtemp(char *); ! 142: char *savetemp(char *, char *); ! 143: void cleanup_tmpf(void); ! 144: int savetempbak(char *, char *); ! 145: ! 146: extern int write_error(FILE *f); ! 147: extern void settmpdir(char *path); ! 148: extern void setoutdir(char *filename); ! 149: extern boolean is_tempfile(char *path); ! 150: extern boolean has_extension(char *filename, char *extension); ! 151: ! 152: /* Directories to search for the manuals */ ! 153: extern char const * const manual_dirs[]; ! 154: /* Returns non-zero if any manuals are missing */ ! 155: unsigned manuals_missing(void);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.