home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / rmslook.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-19  |  2.8 KB  |  112 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: rmslook.c,v 1.8 1998/10/19 01:02:04 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    rmslook.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    08 Dec 1984 (from 'dirent.c')
  9.  * Last update:
  10.  *        18 Oct 1998, use copyBigDate macro to work with DEC C 5.3
  11.  *        18 Feb 1995, port to AXP (DATENT mods)
  12.  *        15 Jun 1985, use 'xabprouic' for CC2.0 change
  13.  *        22 Mar 1985, added file-id, record-length
  14.  *        22 Dec 1984, set '.fallc' (file-allocation) component.
  15.  *        20 Dec 1984, return file-format, organization in the same byte.
  16.  *        15 Dec 1984, clear internal-file-id (W_IFI).  Don't need a
  17.  *                 filespec argument, since the sys-search before
  18.  *                 this procedure does the proper setup.
  19.  *
  20.  * Function:    Lookup information about a particular file, to fill all fields
  21.  *        in the indicated FILENT structure.  Returns TRUE iff the file
  22.  *        was found.
  23.  *
  24.  * Arguments:    z    => FILENT structure to load.  Only those fields which
  25.  *               are implied by the XAB-list are modified.
  26.  *        fab_    => pre-init FAB, XAB-list for the attributes which we
  27.  *               need.
  28.  *
  29.  * Returns:    The worst error found while reading the directory entry.
  30.  */
  31.  
  32. #include    <starlet.h>
  33. #include    <rms.h>
  34. #include    <descrip.h>
  35. #include    <stsdef.h>
  36.  
  37. #include    "flist.h"
  38. #include    "dirent.h"
  39. #include    "xabproui.h"
  40.  
  41. unsigned 
  42. rmslook (FILENT *z, struct FAB *fab_)
  43. {
  44.     unsigned status    = RMS$_NORMAL;        /* return-status    */
  45.     struct    XABALL    *all_    = 0;
  46.     struct    XABDAT    *dat_    = 0;
  47.     struct    XABFHC    *fhc_    = 0;
  48.     struct    XABPRO    *pro_    = 0;
  49.     struct    XABALL    *x_;
  50.     struct    NAM    *nam_;
  51.  
  52.     if (!(x_ = (struct XABALL *)(fab_->fab$l_xab)))    return (status);
  53.  
  54.     fab_->fab$w_ifi = 0;
  55.     z->fstat = status = sys$open(fab_);
  56.  
  57.     if ($VMS_STATUS_SUCCESS(status))
  58.     {
  59.         while (x_)
  60.         {
  61.             switch (x_->xab$b_cod)
  62.             {
  63.             case XAB$C_ALL:    all_ = x_;    break;
  64.             case XAB$C_DAT:    dat_ = (struct XABDAT *)x_;    break;
  65.             case XAB$C_FHC:    fhc_ = (struct XABFHC *)x_;    break;
  66.             case XAB$C_PRO:    pro_ = (struct XABPRO *)x_;    break;
  67.             }
  68.             x_ = (struct XABALL *)x_->xab$l_nxt;
  69.         }
  70.  
  71.         if (fhc_ && all_)
  72.         {
  73.             if ((z->fsize = fhc_->xab$l_ebk) == 0)
  74.                 z->fsize = all_->xab$l_alq;
  75.             else
  76.             {
  77.                 if (fhc_->xab$w_ffb == 0)
  78.                     z->fsize = z->fsize - 1;
  79.             }
  80.             z->fallc = all_->xab$l_alq;
  81.         }
  82.  
  83.         if (dat_)
  84.         {
  85.             copyBigDate(&(z->fexpr), &(dat_->xab$q_edt));
  86.             copyBigDate(&(z->frevi), &(dat_->xab$q_rdt));
  87.             copyBigDate(&(z->fback), &(dat_->xab$q_bdt));
  88.             if (!isOkDate(&(z->fback)))
  89.                 makeBigDate(&(z->fback)); /* (big num)*/
  90.             copyBigDate(&(z->fdate), &(dat_->xab$q_cdt));
  91.         }
  92.  
  93.         z->f_rfm    = fab_->fab$b_rfm & fab_->fab$b_org;
  94.         z->f_rat    = fab_->fab$b_rat;
  95.         z->f_recl    = fab_->fab$w_mrs;
  96.  
  97.         if (pro_)
  98.         {
  99.             z->fprot    = pro_->xab$w_pro;
  100.             xabprouic (pro_, &z->f_grp, &z->f_mbm);
  101.         }
  102.  
  103.         nam_ = fab_->fab$l_nam;    /* => NAM-block */
  104.         z->fidnum[0] = nam_->nam$w_fid[0];
  105.         z->fidnum[1] = nam_->nam$w_fid[1];
  106.         z->fidnum[2] = nam_->nam$w_fid[2];
  107.  
  108.         status = sys$close(fab_);
  109.     }
  110.     return (z->fstat);
  111. }
  112.