Annotation of pgp/src/fileio.h, revision 1.1.1.3

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.