home *** CD-ROM | disk | FTP | other *** search
- /*
- * FILECOPY.H
- *
- * (c)Copyright 1990,93 by Tobias Ferber, All Rights Reserved.
- */
-
- #ifndef FILECOPY_H
- #define FILECOPY_H
-
- #include <stdio.h>
-
- #if 0 /**********************************************************************/
-
- /* shorthand type definitions for unsigned storage classes */
-
- #if !defined(_POSIX_SOURCE) || defined(NO_SHORTHAND_TYPES)
- typedef unsigned char uchar_t;
- typedef unsigned long ulong_t;
- #endif
-
- #endif /*********************************************************************/
-
- /*
- By default, filecopy() will try to malloc() a copy buffer of
- MAXIMUM_BUFFERSIZE bytes. Note that last is limited to 64K
- because malloc() can't allocate more at a time by ANSI definition.
- There are however situations where you don't want filecopy() to
- allocate this buffer on it's own each time. In this case you can
- set a permanent copy buffer via fc_setbuf(). If you do so, please
- don't forget to free() this buffer again via fc_setbuf(0L) after
- having copied all your files.
- Note that fc_setbuf will not check wether you try to allocate
- more than MAXIMUM_BUFFERSIZE bytes, which makes sense if your
- compiler has no limit for malloc() or fc_setbuf() has been patched
- to use something else than malloc() to get some memory.
- Note also that if filecopy fails to allocate a buffer, it will
- copy your file byte for byte.
- */
-
- #define MAXIMUM_BUFFERSIZE (1L<<16)
-
- /*
- * The ftell() function in the c.lib of Dillon's shareware C Compiler DICE
- * seems to be somewhat buggy. If you've got similar problems with ftell()
- * you can comment out the following
-
- #define BUGGY_FTELL
-
- * or simply compile using the -DBUGGY_FTELL option with the result that
- * filecopy() will count bytes instead of asking ftell() about the file size.
- */
-
- /* Do my prototypes look like those of Cray Research, Inc. ?! */
-
- #ifndef __
-
- #if defined (__STDC__) || defined(__cplusplus)
- #define __(protos) protos
- #else /* !(__STDC__ || __cplusplus) */
- #define __(protos) ()
- #endif /* __STDC__ || __cplusplus */
-
- #endif /* !__ */
-
-
- #if defined(__cplusplus) || defined(cplusplus)
- extern "C" {
- #endif
-
- extern unsigned long fc_setbuf __( (unsigned long numbytes) );
- extern long filecopy __( (FILE *src, FILE *dst, long n) );
-
- #if defined(__cplusplus) || defined(cplusplus)
- }
- #endif /* C++ */
-
- /* see filecopy.c for further details... */
-
- #endif /* !FILECOPY_H */
-