home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / flread.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  1.9 KB  |  75 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: flread.c,v 1.6 1995/06/06 10:23:28 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    flread.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    24 Jul 1984
  9.  * Last update:
  10.  *        18 Mar 1995, prototypes
  11.  *        03 Sep 1985, pass-thru 'UPDATE' flag to 'dirent_all'
  12.  *        05 Feb 1985, had coded for-loop wrong.
  13.  *        01 Feb 1985, added another "working..." call (dds_while).
  14.  *        31 Jan 1985, use 'dirread' module to maintain read-list.
  15.  *        06 Dec 1984, use 'nameheap' to store 'readlist'
  16.  *        02 Sep 1984, use "import"
  17.  *        27 Jul 1984
  18.  *
  19.  * Function:    This module performs the READ function for "FLIST".  READ
  20.  *        reads new (or re-reads old) entries into the 'filelist[]'
  21.  *        array.
  22.  *
  23.  *         In 'dirent', we set up and maintain 'readlist', to see which
  24.  *        arguments of READ are new.  Then, if no arguments are given,
  25.  *        simply re-read the entire list.  (Note that this in itself
  26.  *        will not get rid of files added by EDIT, which may have been
  27.  *        deleted by other processes.)
  28.  *
  29.  *        There are actually two commands which call this module:
  30.  *
  31.  *        UPDATE    - directs the program to re-read all directory entries
  32.  *              which match the argument specification.
  33.  *        READ    - directs the program to read only those entries which
  34.  *              were not previously in the database.
  35.  */
  36.  
  37. #include    <signal.h>    /* for 'sleep()' */
  38.  
  39. #include    "flist.h"
  40.  
  41. #include    "dircmd.h"
  42. #include    "dds.h"
  43. #include    "dirent.h"
  44. #include    "dirread.h"
  45.  
  46. tDIRCMD(flread)
  47. {
  48.     FILENT    ztmp,    *z = &ztmp;
  49.     register
  50.     int    j,
  51.         update    = xdcl_->dcl_text[0] == 'U';
  52.     char    filespec[MAX_PATH];
  53.  
  54.     if (xdcl_ = xdcl_->dcl_next)
  55.     {
  56.         for (; xdcl_; xdcl_ = xdcl_->dcl_next)
  57.         {
  58.             dds_while (nullC);
  59.             dirent_all (xdcl_->dcl_text, update);
  60.         }
  61.     }
  62.     else
  63.     {
  64.         for (j = 0; dirread_get (filespec, j); j++)
  65.         {
  66.             flist_tell ("READ: %s", filespec);
  67.             dds_while (nullC);
  68.             sleep(1);
  69.             dirent_all (filespec, update);
  70.         }
  71.     }
  72.  
  73.     dds_all (dds_fast(DDS_U_C), *curfile_);    /* update the screen    */
  74. }
  75.