home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Tickle-4.0.sit.hqx / Tickle-4.0 / src / tar.c < prev    next >
Text File  |  1993-11-06  |  3KB  |  119 lines

  1.  
  2. #pragma segment TAR
  3.  
  4. /*
  5.  * Macintosh TAR
  6.  *
  7.  * Written by Craig Ruff
  8.  *
  9.  * Main routine and global variables.
  10.  */
  11.  
  12. #include "tar.h"
  13. #include <SegLoad.h>
  14. #include <Resources.h>
  15.  
  16. /*
  17.  * Global variable declarations
  18.  */
  19. Boolean autoPage = false;    /* List by screenfulls */
  20. Boolean cvtNl = false;        /* Convert newline to return and back */
  21. Boolean doneFlag = false;    /* Quit item selected? */
  22. Boolean doPrint = false;    /* List to printer */
  23. Boolean ignorez = false;    /* Ignore zero blocks */
  24. Boolean    pOpen = false;        /* Printer open? */
  25. Boolean reblock = false;    /* Read enough for a full block size buffer */
  26. Boolean oldArch = false;    /* Old tar compatible */
  27.  
  28. THPrint    prRecHdl;        /* Printer record (when printing) */
  29.  
  30. char    *arName;        /* Archive file name */
  31. long    arDirID;        /* Archive file DirID */
  32. short    arVRefNum;        /* Archive file VRefNum */
  33.  
  34. short    archive;        /* File descriptor for archive file */
  35. int        blocking;        /* Size of each block, in records */
  36. int        blockSize;        /* Size of each block, in bytes */
  37.  
  38. char    fdCreator[4];    /* Finder Creator */
  39. char    fdType[4];        /* Finder Type */
  40. char    header[128];    /* Common header for listings */
  41. jmp_buf    errJmp;            /* For error exits */
  42.  
  43. int            tar_scripting = 0;
  44. int            tar_listing = 0;
  45. int            tar_list_format = 0;
  46. Tcl_Interp    *tar_interp = NULL;
  47.  
  48.  
  49. tar_initialize()
  50. {
  51. short        saveref;
  52. Handle        fTypeH;
  53. extern short app_refnum;
  54.  
  55.     saveref = CurResFile();
  56.     UseResFile(app_refnum);
  57.     
  58.     tar_scripting = 0;
  59.     tar_listing = 0;
  60.     tar_list_format = 0;
  61.     tar_interp = NULL;
  62.  
  63.     blocking = 20;
  64.     blockSize = blocking * RECORDSIZE;
  65.     if ((fTypeH = GetResource('ftyp', 0)) == NULL)
  66.         {
  67.         strncpy(fdCreator, "????", 4);
  68.         strncpy(fdType, "TEXT", 4);
  69.         } 
  70.     else
  71.         {
  72.         strncpy(fdCreator, *fTypeH, 4);
  73.         strncpy(fdType, (*fTypeH) + 4, 4);
  74.         ReleaseResource(fTypeH);
  75.         }
  76.  
  77.     if ((prRecHdl = (THPrint) NewHandle((long) sizeof(TPrint))) == NULL) {
  78.         OSAlert("\pmain", "\pNewHandle returned NULL", NULL, MemError());
  79.         ExitToShell();
  80.         }
  81.  
  82.     sprintf(header, "T     Size Date              Name%*s", 40, "");
  83.     UseResFile(saveref);
  84.     }
  85.  
  86.  
  87. tar_close()
  88.     {
  89.     if (pOpen)
  90.         PrClose();
  91.     }
  92.  
  93. Boolean
  94. WindInit()
  95.     {
  96.     ShowFeedback();
  97.     return 0;
  98.     }
  99.     
  100. WindEnd(keyWait)
  101. Boolean    keyWait;
  102. {
  103. #pragma unused (keyWait)
  104.  
  105.     /*if (! keyWait)
  106.         HideFeedback();*/
  107.     }
  108.     
  109. WPrintf(format, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
  110. char    *format;
  111. long    arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9;
  112. {
  113. /* long    ticks = TickCount(); */
  114.  
  115.     Feedback(format,
  116.                 arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
  117.     }
  118.     
  119.