osdep.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 1999-Oct-05 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, both of these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
  7. */
  8. #include <sys/types.h>
  9. #include <sys/stat.h>
  10. #include <unistd.h>
  11. #include <support/Errors.h> /* for B_NO_ERROR */
  12. #define USE_EF_UT_TIME /* Enable use of "UT" extra field time info */
  13. #define EB_L_BE_LEN 5 /* min size is an unsigned long and flag */
  14. #define EB_C_BE_LEN 5 /* Length of data in local EF and flag. */
  15. #define EB_BE_FL_NATURAL 0x01 /* data is 'natural' (not compressed) */
  16. #define EB_BE_FL_BADBITS 0xfe /* bits currently undefined */
  17. #ifndef ZP_NEED_MEMCOMPR
  18. # define ZP_NEED_MEMCOMPR
  19. #endif
  20. /* Set a file's MIME type. */
  21. #define BE_FILE_TYPE_NAME "BEOS:TYPE"
  22. void setfiletype( const char *file, const char *type );
  23. /*
  24. DR9 'Be' extra-field layout:
  25. 'Be' - signature
  26. ef_size - size of data in this EF (little-endian unsigned short)
  27. full_size - uncompressed data size (little-endian unsigned long)
  28. flag - flags (byte)
  29. flags & EB_BE_FL_NATURAL = the data is not compressed
  30. flags & EB_BE_FL_BADBITS = the data is corrupted or we
  31. can't handle it properly
  32. data - compressed or uncompressed file attribute data
  33. If flag & EB_BE_FL_NATURAL, the data is not compressed; this optimisation is
  34. necessary to prevent wasted space for files with small attributes (which
  35. appears to be quite common on the Advanced Access DR9 release). In this
  36. case, there should be ( ef_size - EB_L_BE_LEN ) bytes of data, and full_size
  37. should equal ( ef_size - EB_L_BE_LEN ).
  38. If the data is compressed, there will be ( ef_size - EB_L_BE_LEN ) bytes of
  39. compressed data, and full_size bytes of uncompressed data.
  40. If a file has absolutely no attributes, there will not be a 'Be' extra field.
  41. The uncompressed data is arranged like this:
  42. attr_name\0 - C string
  43. struct attr_info (big-endian)
  44. attr_data (length in attr_info.size)
  45. */