home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / dm.lzh / showfiles.c < prev    next >
Text File  |  1995-10-26  |  7KB  |  217 lines

  1. /* showfiles.c function for DISKMASTER.C      */
  2. /* copyright (c) 1995 by Bob Devries          */
  3. /* email: bdevries@gil.ipswichcity.qld.gov.au */
  4.  
  5. /* show the filenames from the global buffers */
  6.  
  7. #include "diskmaster.h"
  8. #include "screen.h"
  9.  
  10. #define S_IFDIR 0x80
  11.  
  12. showfiles(numfiles,pos,fileptr,flag)
  13. int numfiles;          /* number of files in directory */
  14. int pos;               /* position in directory to print from */
  15. int fileptr;           /* current pointer position */
  16. short flag;            /* action flag. */
  17. {
  18.        extern char **nameptr;
  19.        extern short *attrptr;
  20.        int count = 0;
  21.        int fgnd = WHITE;
  22.        int bgnd = BLUE;
  23.        int x;
  24.        
  25.        if(numfiles < 0) {
  26.               gotoxy(1,24);
  27.               cleol();
  28.               printf("     %cNo Files!",7);
  29.               sleep(3);
  30.               commands();
  31.               return(0);
  32.        }
  33.        
  34.        if(flag == REDO) {
  35.        while((count < MAXCNT) && (count + pos <= numfiles)) {
  36.               gotoxy(3,count + 3);
  37.               if((attrptr[pos + count]&S_IFDIR) == S_IFDIR) {
  38.                      foreground(BLACK);
  39.                      fgnd = BLACK;
  40.               }
  41.               if((attrptr[pos + count]&TAG) == TAG) {
  42.                      background(YELLOW);
  43.                      bgnd = YELLOW;
  44.                      foreground(BLACK);
  45.                      fgnd = BLACK;
  46.               }
  47.               if(count + pos == fileptr) {
  48.                      if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
  49.                             fgnd = BLACK;
  50.                             bgnd = WHITE;
  51.                      }
  52.                      if((attrptr[fileptr]&TAG) == TAG) {
  53.                             fgnd = YELLOW;
  54.                             bgnd = BLACK;
  55.                      } else {
  56.                             fgnd = BLUE;
  57.                             bgnd = WHITE;
  58.                      }
  59.                      foreground(WHITE);
  60.                      background(BLUE);
  61.                      get_info(pos + count);
  62.                      gotoxy(3,count+3);
  63.                      background(bgnd);
  64.                      foreground(fgnd);
  65.               }
  66.               printf("%s",nameptr[pos+count]);
  67.               foreground(WHITE);
  68.               background(BLUE);
  69.               fgnd = WHITE;
  70.               bgnd = BLUE;
  71.               for(x = strlen(nameptr[pos + count]); x<28; x++) {
  72.                      printf(" ");
  73.               }
  74.               count++;
  75.        }
  76.        }
  77.        if(flag == DOWN) {
  78.               if((attrptr[fileptr-1]&TAG) == TAG) {
  79.                      background(YELLOW);
  80.                      bgnd = YELLOW;
  81.                      foreground(BLACK);
  82.                      fgnd = BLACK;
  83.               } else {
  84.                      if((attrptr[fileptr-1]&S_IFDIR) == S_IFDIR) {
  85.                             foreground(BLACK);
  86.                             fgnd = BLACK;
  87.                      } else {
  88.                             foreground(WHITE);
  89.                             fgnd = WHITE;
  90.                      }
  91.                      background(BLUE);
  92.                      bgnd = BLUE;
  93.               }
  94.               gotoxy(3,fileptr-pos+3-1);
  95.               printf("%s",nameptr[fileptr-1]);
  96.               foreground(WHITE);
  97.               background(BLUE);
  98.               fgnd = WHITE;
  99.               bgnd = BLUE;
  100.               for(x = strlen(nameptr[fileptr - 1]); x<28; x++) {
  101.                      printf(" ");
  102.               }
  103.               if((attrptr[fileptr]&TAG) == TAG) {
  104.                      background(BLACK);
  105.                      bgnd = BLACK;
  106.                      foreground(YELLOW);
  107.                      fgnd = YELLOW;
  108.               } else {
  109.                      if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
  110.                             foreground(BLACK);
  111.                             fgnd = BLACK;
  112.                      } else {
  113.                             foreground(BLUE);
  114.                             fgnd = BLUE;
  115.                      }
  116.                      background(WHITE);
  117.                      bgnd = WHITE;
  118.               }
  119.               gotoxy(3,fileptr-pos+3);
  120.               printf("%s",nameptr[fileptr]);
  121.               foreground(WHITE);
  122.               background(BLUE);
  123.               fgnd = WHITE;
  124.               bgnd = BLUE;
  125.               for(x = strlen(nameptr[fileptr]); x<28; x++) {
  126.                      printf(" ");
  127.               }
  128.               get_info(fileptr);
  129.        }
  130.        if(flag == UP) {
  131.               if((attrptr[fileptr+1]&TAG) == TAG) {
  132.                      background(YELLOW);
  133.                      bgnd = YELLOW;
  134.                      foreground(BLACK);
  135.                      fgnd = BLACK;
  136.               } else {
  137.                      if((attrptr[fileptr+1]&S_IFDIR) == S_IFDIR) {
  138.                             foreground(BLACK);
  139.                             fgnd = BLACK;
  140.                      } else {
  141.                             foreground(WHITE);
  142.                             fgnd = WHITE;
  143.                      }
  144.                      background(BLUE);
  145.                      bgnd = BLUE;
  146.               }
  147.               gotoxy(3,fileptr-pos+3+1);
  148.               printf("%s",nameptr[fileptr+1]);
  149.               foreground(WHITE);
  150.               background(BLUE);
  151.               fgnd = WHITE;
  152.               bgnd = BLUE;
  153.               for(x = strlen(nameptr[fileptr+1]); x<28; x++) {
  154.                      printf(" ");
  155.               }
  156.               if((attrptr[fileptr]&TAG) == TAG) {
  157.                      background(BLACK);
  158.                      bgnd = BLACK;
  159.                      foreground(YELLOW);
  160.                      fgnd = YELLOW;
  161.               } else {
  162.                      if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
  163.                             foreground(BLACK);
  164.                             fgnd = BLACK;
  165.                      } else {
  166.                             foreground(BLUE);
  167.                             fgnd = BLUE;
  168.                      }
  169.                      background(WHITE);
  170.                      bgnd = WHITE;
  171.               }
  172.               gotoxy(3,fileptr-pos+3);
  173.               printf("%s",nameptr[fileptr]);
  174.               foreground(WHITE);
  175.               background(BLUE);
  176.               fgnd = WHITE;
  177.               bgnd = BLUE;
  178.               for(x = strlen(nameptr[fileptr]); x<28; x++) {
  179.                      printf(" ");
  180.               }
  181.               get_info(fileptr);
  182.        }
  183.        if(flag == TAG) {
  184.               if((attrptr[fileptr]&TAG)==TAG) {
  185.                      foreground(YELLOW);
  186.                      fgnd = YELLOW;
  187.                      background(BLACK);
  188.                      bgnd = BLACK;
  189.               } else {
  190.                      if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
  191.                             foreground(BLACK);
  192.                             fgnd = BLACK;
  193.                             background(WHITE);
  194.                             bgnd = WHITE;
  195.                      } else {
  196.                             foreground(BLUE);
  197.                             fgnd = BLUE;
  198.                             background(WHITE);
  199.                             bgnd = WHITE;
  200.                      }
  201.               }
  202.               gotoxy(3,fileptr-pos+3);
  203.               printf("%s",nameptr[fileptr]);
  204.               foreground(WHITE);
  205.               background(BLUE);
  206.               fgnd = WHITE;
  207.               bgnd = BLUE;
  208.               for(x = strlen(nameptr[fileptr]); x<28; x++) {
  209.                      printf(" ");
  210.               }
  211.               get_info(fileptr);
  212.        }
  213.        gotoxy(1,24);
  214. }
  215.  
  216. /* EOF showfiles.c */
  217.