home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / tarsrc30.sit / tar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-04  |  4.0 KB  |  174 lines

  1. #ifndef USEDUMP
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Fonts.h>
  6. #include <OSEvents.h>
  7. #include <Controls.h>
  8. #include <Windows.h>
  9. #include <Menus.h>
  10. #include <TextEdit.h>
  11. #include <Dialogs.h>
  12. #include <Desk.h>
  13. #include <ToolUtils.h>
  14. #include <OSUtils.h>
  15. #include <Scrap.h>
  16. #include <Packages.h>
  17. #include <Lists.h>
  18. #include <Files.h>
  19. #include <Memory.h>
  20. #include <Printing.h>
  21. #include <Errors.h>
  22.  
  23. #ifndef EOF
  24. #define EOF    (-1L)
  25. #endif
  26.  
  27. #define DIRECTORY(pb)    (((pb).hFileInfo.ioFlAttrib & ioDirMask) == ioDirMask)
  28.  
  29. /*
  30.  * Character definitions
  31.  */
  32. #define ENTER    0x03
  33. #define BS    0x08
  34. #define TAB    0x09
  35. #define LF    0x0a
  36. #define    RETURN    0x0d
  37.  
  38. /*
  39.  * Difference between Mac and Unix times
  40.  */
  41. #define TIMEDIFF    0x7c25b080
  42.  
  43. /*
  44.  * Global Variables
  45.  */
  46. extern struct pref {
  47.     Boolean    autoPage;    /* List by screenfulls */
  48.     Boolean    cvtNl;        /* Convert newline to return and back */
  49.     Boolean    dosCvt;        /* Convert DOS style newlines (extract only) */
  50.     Boolean    doPrint;    /* List to printer */
  51.     Boolean    floppy;        /* Use a floppy as the archive file */
  52.     Boolean    oldArch;    /* Old tar compatible */
  53.     int    blocking;    /* Size of each block, in records */
  54.     int    blockSize;    /* Size of each block, in bytes */
  55.     char    creator[4];    /* Finder Creator */
  56.     char    type[4];    /* Finder Type */
  57. } pref;
  58.  
  59. extern Boolean    doneFlag;
  60. extern Boolean    ignorez;
  61. extern Boolean    menusOK;
  62. extern Boolean    pOpen;
  63.  
  64. extern char    header[];
  65.  
  66. extern THPrint    prRecHdl;
  67.  
  68. /*
  69.  * Standard File and GetDir saved outputs
  70.  */
  71. extern long    dirDirID;
  72. extern short    dirVRefNum;
  73.  
  74. /*
  75.  * External routines
  76.  */
  77. extern Boolean    GetDir();
  78. extern Boolean    MenuInit();
  79. extern Boolean    PrSetup();
  80. extern Boolean    WindInit();
  81.  
  82. /*
  83.  * Remainder taken from:
  84.  * Header file for public domain tar (tape archive) program.
  85.  *
  86.  * @(#)tar.h 1.20 86/10/29    Public Domain.
  87.  *
  88.  * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
  89.  */
  90.  
  91. /*
  92.  * Header block on tape.
  93.  *
  94.  * I'm going to use traditional DP naming conventions here.
  95.  * A "block" is a big chunk of stuff that we do I/O on.
  96.  * A "record" is a piece of info that we care about.
  97.  * Typically many "record"s fit into a "block".
  98.  */
  99. #define    RECORDSIZE    512
  100. #define    NAMSIZ    100
  101. #define    TUNMLEN    32
  102. #define    TGNMLEN    32
  103.  
  104. union record {
  105.     char        charptr[RECORDSIZE];
  106.     struct header {
  107.         char    name[NAMSIZ];
  108.         char    mode[8];
  109.         char    uid[8];
  110.         char    gid[8];
  111.         char    size[12];
  112.         char    mtime[12];
  113.         char    chksum[8];
  114.         char    linkflag;
  115.         char    linkname[NAMSIZ];
  116.         char    magic[8];
  117.         char    uname[TUNMLEN];
  118.         char    gname[TGNMLEN];
  119.         char    devmajor[8];
  120.         char    devminor[8];
  121.     } header;
  122. };
  123.  
  124. /* The checksum field is filled with this while the checksum is computed. */
  125. #define    CHKBLANKS    "        "    /* 8 blanks, no null */
  126.  
  127. /* The magic field is filled with this if uname and gname are valid. */
  128. #define    TMAGIC        "ustar  "    /* 7 chars and a null */
  129.  
  130. /* The linkflag defines the type of file */
  131. #define    LF_OLDNORMAL    '\0'        /* Normal disk file, Unix compat */
  132. #define    LF_NORMAL    '0'        /* Normal disk file */
  133. #define    LF_LINK        '1'        /* Link to previously dumped file */
  134. #define    LF_SYMLINK    '2'        /* Symbolic link */
  135. #define    LF_CHR        '3'        /* Character special file */
  136. #define    LF_BLK        '4'        /* Block special file */
  137. #define    LF_DIR        '5'        /* Directory */
  138. #define    LF_FIFO        '6'        /* FIFO special file */
  139. #define    LF_CONTIG    '7'        /* Contiguous file */
  140. /* Further link types may be defined later. */
  141.  
  142. /*
  143.  * Global variables
  144.  */
  145. extern Boolean        reblock;
  146.  
  147. /*
  148.  * We now default to Unix Standard format rather than 4.2BSD tar format.
  149.  * The code can actually produce all three:
  150.  *    standard    ANSI standard
  151.  *    oldarch        V7
  152.  *    neither        4.2BSD
  153.  * but we don't bother, since 4.2BSD can read ANSI standard format anyway.
  154.  * The only advantage to the "neither" option is that we can cmp(1) our
  155.  * output to the output of 4.2BSD tar, for debugging.
  156.  */
  157. #define    standard    (!pref.oldArch)
  158.  
  159. extern short    archive;    /* File descriptor for archive file */
  160.  
  161. /*
  162.  * Declarations of functions available to the world.
  163.  */
  164. union record    *FindRec();
  165. void        UseRec();
  166. union record    *EndOfRecs();
  167. Boolean        OpenArchive();
  168.  
  169. #ifdef MAKEDUMP
  170. #pragma dump "hdrs.dmp"
  171. #endif
  172. #else
  173. #pragma load "hdrs.dmp"
  174. #endif