home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / misc / cvt / source / filecopy.h < prev    next >
C/C++ Source or Header  |  1995-03-03  |  2KB  |  80 lines

  1. /*
  2.  *  FILECOPY.H
  3.  *
  4.  *  (c)Copyright 1990,93 by Tobias Ferber,  All Rights Reserved.
  5.  */
  6.  
  7. #ifndef FILECOPY_H
  8. #define FILECOPY_H
  9.  
  10. #include <stdio.h>
  11.  
  12. #if 0 /**********************************************************************/
  13.  
  14. /* shorthand type definitions for unsigned storage classes */
  15.  
  16. #if !defined(_POSIX_SOURCE) || defined(NO_SHORTHAND_TYPES)
  17. typedef unsigned char uchar_t;
  18. typedef unsigned long ulong_t;
  19. #endif
  20.  
  21. #endif /*********************************************************************/
  22.  
  23. /*
  24.    By default, filecopy() will try to malloc() a copy buffer of
  25.    MAXIMUM_BUFFERSIZE bytes.  Note that last is limited to 64K
  26.    because malloc() can't allocate more at a time by ANSI definition.
  27.    There are however situations where you don't want filecopy() to
  28.    allocate this buffer on it's own each time.  In this case you can
  29.    set a permanent copy buffer via fc_setbuf().  If you do so, please
  30.    don't forget to free() this buffer again via fc_setbuf(0L) after
  31.    having copied all your files.
  32.    Note that fc_setbuf will not check wether you try to allocate
  33.    more than MAXIMUM_BUFFERSIZE bytes, which makes sense if your
  34.    compiler has no limit for malloc() or fc_setbuf() has been patched
  35.    to use something else than malloc() to get some memory.
  36.    Note also that if filecopy fails to allocate a buffer, it will
  37.    copy your file byte for byte.
  38. */
  39.  
  40. #define MAXIMUM_BUFFERSIZE (1L<<16)
  41.  
  42. /*
  43.  * The ftell() function in the c.lib of Dillon's shareware C Compiler DICE
  44.  * seems to be somewhat buggy.  If you've got similar problems with ftell()
  45.  * you can comment out the following
  46.  
  47. #define BUGGY_FTELL
  48.  
  49.  * or simply compile using the -DBUGGY_FTELL option with the result that
  50.  * filecopy() will count bytes instead of asking ftell() about the file size.
  51.  */
  52.  
  53. /* Do my prototypes look like those of Cray Research, Inc. ?! */
  54.  
  55. #ifndef __
  56.  
  57. #if defined (__STDC__) || defined(__cplusplus)
  58. #define __(protos) protos
  59. #else /* !(__STDC__ || __cplusplus) */
  60. #define __(protos) ()
  61. #endif /* __STDC__ || __cplusplus */
  62.  
  63. #endif /* !__ */
  64.  
  65.  
  66. #if defined(__cplusplus) || defined(cplusplus)
  67. extern "C" {
  68. #endif
  69.  
  70. extern unsigned long fc_setbuf __( (unsigned long numbytes) );
  71. extern long filecopy   __( (FILE *src, FILE *dst, long n) );
  72.  
  73. #if defined(__cplusplus) || defined(cplusplus)
  74. }
  75. #endif /* C++ */
  76.  
  77. /* see filecopy.c for further details... */
  78.  
  79. #endif /* !FILECOPY_H */
  80.