home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / beos / osdep.h < prev    next >
C/C++ Source or Header  |  1997-10-09  |  3KB  |  75 lines

  1. /*
  2.  
  3.  Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  4.  Kai Uwe Rommel, Onno van der Linden and Igor Mandrichenko.
  5.  Permission is granted to any individual or institution to use, copy, or
  6.  redistribute this software so long as all of the original files are included,
  7.  that it is not sold for profit, and that this copyright notice is retained.
  8.  
  9. */
  10.  
  11. /* Get the right unistd.h; sure wish our headers weren't so screwed. */
  12. #ifdef __GNUC__
  13. #define __USE_FIXED_PROTOTYPES__
  14. #endif
  15.  
  16. #include <sys/types.h>
  17. #include <sys/stat.h>
  18. #include <unistd.h>
  19.  
  20. #include <support/Errors.h>     /* for B_NO_ERROR */
  21.  
  22. #define USE_EF_UT_TIME          /* Enable use of "UT" extra field time info */
  23.  
  24. #define EB_L_BE_LEN 5           /* min size is an unsigned long and flag */
  25. #define EB_C_BE_LEN 5           /* Length of data in local EF and flag.  */
  26.  
  27. #define EB_BE_FL_NATURAL    0x01    /* data is 'natural' (not compressed) */
  28. #define EB_BE_FL_BADBITS    0xfe    /* bits currently undefined           */
  29.  
  30. /* Set a file's MIME type. */
  31. #define BE_FILE_TYPE_NAME   "BEOS:TYPE"
  32. void setfiletype( const char *file, const char *type );
  33.  
  34. #ifdef __GNUC__
  35. #  ifndef readlink
  36. /* Somehow, GNU C is missing this for zipup.c. */
  37. extern ssize_t      readlink(const char *path, char *buf, size_t bufsize);
  38. #  endif
  39. #endif
  40.  
  41. /* Leave this defined until BeOS has a way of accessing the attributes on a */
  42. /* symbolic link from C.  This might appear in DR10, but it doesn't exist   */
  43. /* in Preview Release or Preview Release 2 (aka DR9 and DR9.1). [cjh]       */
  44. #define BE_NO_SYMLINK_ATTRS 1
  45.  
  46. /*
  47. DR9 'Be' extra-field layout:
  48.  
  49. 'Be'      - signature
  50. ef_size   - size of data in this EF (little-endian unsigned short)
  51. full_size - uncompressed data size (little-endian unsigned long)
  52. flag      - flags (byte)
  53.             flags & EB_BE_FL_NATURAL    = the data is not compressed
  54.             flags & EB_BE_FL_BADBITS    = the data is corrupted or we
  55.                                           can't handle it properly
  56. data      - compressed or uncompressed file attribute data
  57.  
  58. If flag & EB_BE_FL_NATURAL, the data is not compressed; this optimisation is
  59. necessary to prevent wasted space for files with small attributes (which
  60. appears to be quite common on the Advanced Access DR9 release).  In this
  61. case, there should be ( ef_size - EB_L_BE_LEN ) bytes of data, and full_size
  62. should equal ( ef_size - EB_L_BE_LEN ).
  63.  
  64. If the data is compressed, there will be ( ef_size - EB_L_BE_LEN ) bytes of
  65. compressed data, and full_size bytes of uncompressed data.
  66.  
  67. If a file has absolutely no attributes, there will not be a 'Be' extra field.
  68.  
  69. The uncompressed data is arranged like this:
  70.  
  71. attr_name\0 - C string
  72. struct attr_info
  73. attr_data (length in attr_info.size)
  74. */
  75.