home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 240.lha / PickPacket_v1.0 / Sources / stfib.c < prev    next >
C/C++ Source or Header  |  1989-05-04  |  4KB  |  130 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  3. * |. o.| ||          All Rights Reserved                                  *
  4. * | .  | ||          Written by John Toebes and Doug Walker               *
  5. * | o  | ||          The Software Distillery                              *
  6. * |  . |//           235 Trillingham Lane                                 *
  7. * ======             Cary, NC 27513                                       *
  8. *                    BBS:(919)-471-6436                                   *
  9. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  10. #include "pickpack.h"
  11. #include "struct.h"
  12. #include "fibgen.h"
  13.  
  14. static struct IntuiText IText =
  15. {
  16.     1,0,JAM2,   /* front and back text pens, drawmode and fill byte */
  17.     0,0,       /* XY origin relative to container TopLeft */
  18.     &TOPAZ80,   /* font pointer or NULL for default */
  19.     NULL,       /* pointer to text */
  20.     NULL        /* next IntuiText structure */
  21. };
  22.  
  23. void stfibnew(nw, it, stnode)
  24. struct NewWindow **nw;
  25. struct IntuiText **it;
  26. struct STNODE *stnode;
  27. {
  28.    *nw = &NewWindowStructure1;
  29.    *it = NULL;
  30.    return;
  31. }
  32.  
  33.  
  34. /* Display the struct FileInfoBlock */
  35. int stfibdisp(n)
  36. struct STNODE *n;
  37. {
  38.    char data[100];
  39.    char date[20];
  40.    int len;
  41.    char *p, *targ;
  42.    struct FileInfoBlock *fib;
  43.  
  44.    INITTEXT(14)
  45.  
  46.    BUG(1, ("stfibdisp: Entry, stnode 0x%08x window 0x%08x\n", n, n->w))
  47.  
  48.    fib = n->d.fib;
  49.  
  50.    sprintf(data, "     fib_DiskKey: 0x%08x (Handler-Dependant)" , fib->fib_DiskKey);
  51.    SHOWTEXT
  52.  
  53.    if (fib->fib_DirEntryType < 0) p = "(PLAIN FILE)";
  54.    else                           p = "(DIRECTORY) ";
  55.    sprintf(data, "fib_DirEntryType: %10d %s", fib->fib_DirEntryType, p);
  56.    SHOWTEXT
  57.  
  58.    p = fib->fib_FileName;
  59.    len = *p++;
  60.    if (len > 32 | len < 0) len = 32;
  61.    strcpy(data, "    fib_FileName: ");
  62.    targ = data+strlen(data);
  63.    memset(targ, ' ', 32);
  64.    memcpy(targ, p, len);
  65.    targ[32] = 0;
  66.    SHOWTEXT
  67.  
  68.  
  69.    sprintf(data, "  fib_Protection: 0x%08x (Protect: --------)", fib->fib_Protection);
  70.    /*             01234567890123456789012345678901234567890123"
  71.    /* We probably want to interpret the protection bits too */
  72.    if (fib->fib_Protection & FIBF_SCRIPT)     data[36] = 'S';
  73.    if (fib->fib_Protection & FIBF_PURE)       data[37] = 'P';
  74.    if (fib->fib_Protection & FIBF_ARCHIVE)    data[38] = 'A';
  75.    if (!(fib->fib_Protection & FIBF_READ))    data[39] = 'R';
  76.    if (!(fib->fib_Protection & FIBF_WRITE))   data[40] = 'W';
  77.    if (!(fib->fib_Protection & FIBF_EXECUTE)) data[41] = 'E';
  78.    if (!(fib->fib_Protection & FIBF_DELETE))  data[42] = 'D';
  79.    SHOWTEXT
  80.  
  81.    if (fib->fib_EntryType < 0) p = "(PLAIN FILE)";
  82.    else                        p = "(DIRECTORY) ";
  83.    sprintf(data, "   fib_EntryType: %10d %s", fib->fib_EntryType, p);
  84.    SHOWTEXT
  85.  
  86.    sprintf(data, "        fib_Size: %10d (File size in bytes)", fib->fib_Size);
  87.    SHOWTEXT
  88.  
  89.    sprintf(data, "   fib_NumBlocks: %10d (File size in blks)", fib->fib_NumBlocks);
  90.    SHOWTEXT
  91.  
  92.    FormatDate(&fib->fib_Date, date);
  93.    sprintf(data, "   fib_DateStamp: %s (See below)", date);
  94.    SHOWTEXT
  95.  
  96.    sprintf(data, "  ds_Days: %10d    (Days since 1978)", fib->fib_Date.ds_Days);
  97.    SHOWTEXT
  98.  
  99.    sprintf(data, "ds_Minute: %10d    (Min since midnight)", fib->fib_Date.ds_Minute);
  100.    SHOWTEXT
  101.  
  102.    sprintf(data, "  ds_Tick: %10d    (50 ticks/sec)", fib->fib_Date.ds_Tick);
  103.    SHOWTEXT
  104.  
  105.    p = fib->fib_Comment;
  106.    len = *p++;
  107.    if (len > 30) len = 30;
  108.    sprintf(data, "     fib_Comment: ");
  109.    targ = data+strlen(data);
  110.    memset(targ, ' ', 30);
  111.    memcpy(targ, p, len);
  112.    targ[30] = 0;
  113.    SHOWTEXT
  114.  
  115.    memset(data, ' ', 50);
  116.    p = fib->fib_Comment;
  117.    len = *p++ - 30;
  118.    if (len > 0)
  119.       memcpy(data+5, p, len);
  120.    data[50] = 0;
  121.    SHOWTEXT
  122.  
  123.    BUG(1, ("stfibdisp: Exit\n"))
  124.    return(RC_OK);
  125. }
  126.  
  127.  
  128.  
  129.  
  130.