|
|
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: /* Returns TRUE iff file is can be opened for reading. */
45: boolean file_exists(char *filename);
46:
47: /* Returns TRUE iff file can be opened for writing. Does not harm file! */
48: boolean file_ok_write(char *filename);
49:
50: /* Completely overwrite and erase file of given name, so that no sensitive
51: information is left on the disk */
52: int wipefile(char *filename);
53:
54: /* Return the after-slash part of the filename */
55: char *file_tail (char *filename);
56: /* Returns TRUE if user left off file extension, allowing default */
57: boolean no_extension(char *filename);
58:
59: /* Deletes trailing ".xxx" file extension after the period */
60: void drop_extension(char *filename);
61:
62: /* Append filename extension if there isn't one already */
63: void default_extension(char *filename, char *extension);
64:
65: /* Change the filename extension */
66: void force_extension(char *filename, char *extension);
67:
68: /* Get yes/no answer from user, returns TRUE for yes, FALSE for no */
69: boolean getyesno(char default_answer);
70:
71: /* If luser consents to it, change the filename extension */
72: char *maybe_force_extension(char *filename, char *extension);
73:
74: /* Builds a filename with a complete path specifier from the environmental
75: variable PGPPATH */
76: char *buildfilename(char *result, char *fname);
77:
78: /* Build a path for fileName based on origPath */
79: int build_path(char *path, char *fileName, char *origPath);
80:
81: /* Convert filename to canonical form, with slashes as separators */
82: void file_to_canon(char *filename);
83:
84: /* Convert filename from canonical to local form */
85: void file_from_canon(char *filename);
86:
87: /* Copy file f to file g, for longcount bytes */
88: int copyfile(FILE *f, FILE *g, word32 longcount);
89:
90: /* Copy file f to file g, for longcount bytes, positioning f at fpos */
91: int copyfilepos (FILE *f, FILE *g, word32 longcount, word32 fpos);
92:
93: /* Copy file f to file g, for longcount bytes. Convert to canonical form
94: as we go. f is open in text mode. Canonical form uses crlf's as line
95: separators */
96: int copyfile_to_canon (FILE *f, FILE *g, word32 longcount);
97:
98: /* Copy file f to file g, for longcount bytes. Convert from canonical to
99: local form as we go. g is open in text mode. Canonical form uses crlf's
100: as line separators */
101: int copyfile_from_canon (FILE *f, FILE *g, word32 longcount);
102:
103: /* Copy srcFile to destFile */
104: int copyfiles_by_name(char *srcFile, char *destFile);
105:
106: /* Copy srcFile to destFile, converting to canonical text form */
107: int make_canonical(char *srcFile, char *destFile);
108:
109: /* Like rename() but will try to copy the file if the rename fails. This is
110: because under OS's with multiple physical volumes if the source and
111: destination are on different volumes the rename will fail */
112: int rename2(char *srcFile, char *destFile);
113:
114: /* Read the data from stdin to the phantom input file */
115: int readPhantomInput(char *filename);
116:
117: /* Write the data from the phantom output file to stdout */
118: int writePhantomOutput(char *filename);
119:
120: /* Return the size from the current position of file f to the end */
121: word32 fsize (FILE *f);
122:
123: /* Return TRUE if file filename is a text file */
124: int is_text_file (char *filename);
125:
126: FILE *fopenbin(char *, char *);
127: FILE *fopentxt(char *, char *);
128:
129: VOID *xmalloc(unsigned);
130:
131: char *tempfile(int);
132: void rmtemp(char *);
133: char *savetemp(char *, char *);
134: void cleanup_tmpf(void);
135: int savetempbak(char *, char *);
1.1.1.3 root 136:
137: extern int write_error(FILE *f);
138: extern void settmpdir(char *path);
139: extern void setoutdir(char *filename);
140: extern boolean is_tempfile(char *path);
141: extern boolean has_extension(char *filename, char *extension);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.