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