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

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: rmscc.c,v 1.4 1995/06/06 13:05:34 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    rmscc.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    02 Jan 1985
  9.  * Last update:    20 Feb 1985, return "-1" if file has undefined format
  10.  *        18 Feb 1985, return "-1" if file is not in sequential format
  11.  *        15 Feb 1985, return "-1" if 512-byte record (OBJ, EXE types)
  12.  *
  13.  * Function:    RMSCC is designed be used in conjunction with the 'rmsio'
  14.  *        module.  It tests the format+attributes of an open file to see
  15.  *        if its format implies carriage control.  RMSCC is used by the
  16.  *        BROWSE program to determine if the input file contains carriage
  17.  *        control, or if each record should be interpreted as a newline,
  18.  *        or if the file contains neither explicit or implied carriage
  19.  *        control.
  20.  *
  21.  * Arguments:    rab_    => RAB which in turn points to a FAB which contains
  22.  *               codes defining the format+attributes
  23.  *
  24.  * Returns:    0    if the file uses no carriage-control,
  25.  *        1    if the file uses implicit or explicit carriage control,
  26.  *        -1    if the file is formatted FIX-512 or VAR-512 (ordinary
  27.  *            binary files on VMS).
  28.  */
  29.  
  30. #include    "rmscc.h"
  31.  
  32. bool    rmscc (RFILE *fp)
  33. {
  34.     register struct RAB *rab_ = &(fp->rab);
  35.     register struct    FAB    *fab_    = rab_->rab$l_fab;
  36.     register int    rfm    = fab_->fab$b_rfm;
  37.     register int    rat    = fab_->fab$b_rat;
  38.     register int    code    = 0;
  39.  
  40.     if ((rfm == FAB$C_STMLF)
  41.     ||  (rfm == FAB$C_STMCR)
  42.     ||  (rat &  FAB$M_FTN)
  43.     ||  (rat &  FAB$M_CR)
  44.     ||  (rat &  FAB$M_PRN))
  45.         code = 1;
  46.     else if ((rfm == FAB$C_FIX || rfm == FAB$C_VAR)
  47.     &&     (fab_->fab$w_mrs == 512))
  48.         code = -1;
  49.     else if ((fab_->fab$b_org != FAB$C_SEQ)
  50.     ||     (rfm == FAB$C_UDF) )
  51.         code = -1;
  52.     return (code);
  53. }
  54.