home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2003 November / VPR0311.ISO / OLS / TAR32223 / tar32223.lzh / tar32_2 / src / cpio.h < prev    next >
C/C++ Source or Header  |  2003-01-17  |  1KB  |  41 lines

  1. /*
  2.     cpio.h
  3. */
  4.  
  5. #ifndef ___CPIO_H
  6. #define ___CPIO_H
  7. #include <memory.h>
  8.  
  9. /*    Reference: GNU cpio cpiohdr.h */
  10. /* "New" portable format and CRC format:
  11.  
  12.    Each file has a 110 byte header,
  13.    a variable length, NUL terminated filename,
  14.    and variable length file data.
  15.    A header for a filename "TRAILER!!!" indicates the end of the archive.  */
  16.  
  17. /* All the fields in the header are ISO 646 (approximately ASCII) strings
  18.    of hexadecimal numbers, left padded, not NUL terminated. */
  19. struct new_cpio_header
  20. {
  21.   char magic[6];    /* "070701" for "new" portable format, "070702" for CRC format */
  22.   char inode[8];
  23.   char mode[8];
  24.   char uid[8];
  25.   char gid[8];
  26.   char nlink[8];
  27.   char mtime[8];
  28.   char size[8];    /* must be 0 for FIFOs and directories */
  29.   char devmajor[8];
  30.   char devminor[8];
  31.   char rdevmajor[8];    /*only valid for chr and blk special files*/
  32.   char rdevminor[8];  /*only valid for chr and blk special files*/
  33.   char namesize[8]; /*count includes terminating NUL in pathname*/
  34.   char chksum[8];  /* 0 for "new" portable format; for CRC format the sum of all the bytes in the file  */
  35.   int magic_check(){
  36.       return memcmp(magic,"070701",6) == 0 || memcmp(magic,"070702",6) == 0;
  37.   };
  38. };
  39.  
  40. #endif /* CPIO_H */
  41.