osdep.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #ifndef _OSDEP_H_
  9. #define _OSDEP_H_
  10. #include <sys/types.h>
  11. #include <sys/stat.h>
  12. #include <sys/unistd.h>
  13. #define USE_EF_UT_TIME /* Enable use of "UT" extra field time info */
  14. #define EB_L_AT_LEN 5 /* min size is an unsigned long and flag */
  15. #define EB_C_AT_LEN 5 /* Length of data in local EF and flag. */
  16. #define EB_AT_FL_NATURAL 0x01 /* data is 'natural' (not compressed) */
  17. #define EB_AT_FL_BADBITS 0xfe /* bits currently undefined */
  18. #ifndef ZP_NEED_MEMCOMPR
  19. define ZP_NEED_MEMCOMPR
  20. #endif
  21. #define deletedir(d) rmdir(d);
  22. /* Set a file's MIME type. */
  23. void setfiletype( const char *file, const char *type );
  24. /*
  25. 'At' extra-field layout:
  26. 'At' - signature
  27. ef_size - size of data in this EF (little-endian unsigned short)
  28. full_size - uncompressed data size (little-endian unsigned long)
  29. flag - flags (byte)
  30. flags & EB_AT_FL_NATURAL = the data is not compressed
  31. flags & EB_AT_FL_BADBITS = the data is corrupted or we
  32. can't handle it properly
  33. data - compressed or uncompressed file attribute data
  34. If flag & EB_AT_FL_NATURAL, the data is not compressed; this optimisation is
  35. necessary to prevent wasted space for files with small attributes. In this
  36. case, there should be ( ef_size - EB_L_AT_LEN ) bytes of data, and full_size
  37. should equal ( ef_size - EB_L_AT_LEN ).
  38. If the data is compressed, there will be ( ef_size - EB_L_AT_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 'At' extra field.
  41. The uncompressed data is arranged like this:
  42. attr_name\0 - C string
  43. struct attr_info (little-endian)
  44. attr_data (length in attr_info.ai_size)
  45. */
  46. #endif