From:	CSBVAX::MRGATE!@KL.SRI.Com,@wiscvm.wisc.edu:JOE@FHCRCVAX.BITNET@SMTP 22-AUG-1987 06:24
To:	EVERHART
Subj:	FILE Utility, C source

Received: from wiscvm.wisc.edu by KL.SRI.COM with TCP; Sat 22 Aug 87 00:39:28-PDT
Received: from FHCRCVAX.BITNET by wiscvm.wisc.edu ; Sat, 22 Aug 87 02:39:54 CDT
Date: Sat, 22 Aug 87 00:31 PDT
From: Joe Meadows <JOE%FHCRCVAX.BITNET@wiscvm.wisc.edu>
Subject: FILE Utility, C source
To: info-vax@kl.sri.COM
X-VMS-To: INFO-VAX

Hello Everyone,

  Here's the latest C source to FILE. It would be much shorter if it
weren't for all the include files I had to make (and debug, bleah)
using the definitions from LIB.MLB. I placed the help file at the beginning
so you could perouse it before deciding to keep it or throw it away.
Hopefully you keep it and find a lot of use for it.

  Cheers,
  Joe Meadows Jr.
  Fred Hutchinson Cancer Research Center
     bitnet - JOE@FHCRCVAX
     arpa   - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU
     voice  - (206) 467-4970

$ create/log FILE.HLP
$DECK
1 FILE
    FILE is a utility for modifying file attributes.

    FILE DOES NOT convert a file. FILE changes characteristics of
the file, and thus VMS' view of the file. FILE can be used simply to view
the current characteristics of a file, or it can be used to change any of
the changeable characteristics. This utility can be VERY dangerous, and
should only be used if you have a good understanding of RMS. Care should
be taken when using this utility. While it doesn't actually change the file
itself, you might consider using a backup copy of the file.

    The first thing you should do is to use FILE/OUTPUT=output
to generate a listing of the current characteristics of the file. In
this way, you will be able to return the file to its original state.
2 Examples
    One common use of file, is to 'coerce' a file into being a
    Fixed 512 byte file, to upload/download the file via kermit.
    For example, given a saveset A.SAV, you could do the following:

 FILE/OUTPUT=A.FIX/NOEXACT A.SAV/RECORD_SIZE=512/ORGANIZATION=INDEXED

    You could then transfer the two files A.FIX and A.SAV
    using Kermit (it would take two transfers, A.FIX with
    'set file type text', and A.SAV using 'set file type fixed')

    To turn the file back into its original useable self, you could
    then do:
 @A.FIX
    Which would cause the originally saved characteristics to be put
    back on the file.


    Another common use is to set the Fortran carriage control attribute
    so that a file can be printed with fortran carriage control, this
    can be done as follows:

 FILE/OUTPUT=OLD.TMP NETMONTH.*/ATTRIBUTES=(FORTRANCC,NOIMPLIEDCC,NOPRINTCC)

2 parameters
    File takes one parameter, a filename, or list of filenames.
    The filenames can be wildcarded.
2 qualifiers
/OUTPUT
    /OUTPUT[=filename]

    This qualifier causes the characteristics of the file to
    be displayed. Note that if you are also changing characteristics
    the displayed characteristics are the orginal characteristics.
    You can have the output placed in a file, by specifying a file
    name in the OUTPUT clause. This is usefull for restoring a file
    to its original state.
/EXACT
    /[NO]EXACT

    When used with /OUTPUT, this qualifier determines wether a
  complete file spec is displayed (/EXACT) or wether only the filename and
  filetype will be displayed (/NOEXACT).

    /EXACT is the default.
/ATTRIBUTES
    This qualifier determines the record attributes.
    You may enter a list of (negatable) attributes.
    The following attributes are legal:
        FORTRANCC
        IMPLIEDCC
        PRINTCC
        SPAN
/CHARACTERISTICS
    This qualifier determines the file characteristics.
    You may enter a list of (negatable) items.
    The following items are legal:
        ACL_CORRUPT
        BACKUP
        BEST_TRY_CONTIGUOUS
        CHARGE
        CONTIGUOUS
        DIRECTORY
        ERASE_ON_DELETE
        FILE_CORRUPT
        LOCKED
        MARKED_FOR_DELETE
        READ_VERIFY
        SPOOL
        WRITE_BACK
        WRITE_VERIFY
    Note that not all of these items are really changeable. They
    are merely included for completeness sake.
/ORGANIZATION
    This qualifier determines the file organization.
    you must enter one of:
        DIRECT
        INDEXED
        RELATIVE
        SEQUENTIAL
/TYPE
    This qualifier determines the record type.
    you must enter one of:
        FIXED
        VARIABLE
        VFC
        STREAM
        LFSTREAM
        CRSTREAM
        UNDEFINED
/BUCKET_SIZE
    This qualifier determines the bucket size.
/DEFAULT_EXTEND_QUANTITY
    This qualifier determines the default extend quantity.
/END_OF_FILE_BLOCK
    This qualifier determines the end of file block.
/FIRST_FREE_BYTE
    This qualifier determines the first free byte in the end
    of file block.
/HIGHEST_ALLOCATED_BLOCK
    This qualifier determines the highest allocated block.
/GLOBAL_BUFFER_COUNT
    This qualifier determines the global buffer count.
/JOURNAL
    This qulifier determines the type of journaling enabled on the file.
    you must enter on of:
        JOURNAL
        AIJNL
        ATJNL
        BIJNL
        RUJNL
        NEVER_RU
        ONLY_RU
/MAXIMUM_RECORD_SIZE
    This qualifier determines the maximum record size.
/RECORD_SIZE
    This qualifier determines the record size.
/DIRECTORY_VERSION_LIMIT
    This qualifier allows you to set the default number of allowable
    versions of file. This is applicable only to directories. Note that
    32767 is equivalent to 0, or No Limit, so to say.

    This is equivalent to SET DIRECTORY/VERSION=n.
/VERSION_LIMIT
    This qualifier allows you to set the number of allowable versions
    of a file. Note that 32767 is equivalent to 0, or No Limit, so to say.

    This is equivalent to SET FILE/VERSION=n.
/VFC_SIZE
    This qualifier allows you to set the vcf size.
/CREATION_DATE
    /[NO]CREATION_DATE

    This qualifier allows you to set the creation date.
/REVISION_DATE
    /[NO]REVISION_DATE

    This qualifier allows you to set the revision date.
/EXPIRATION_DATE
    /[NO]EXPIRATION_DATE

    This qualifier allows you to set the expiration date.
/BACKUP_DATE
    /[NO]BACKUP_DATE

    This qualifier allows you to set the backup date.
/NUMBER_OF_REVISIONS
    This qualifier allows you to set the number of revisions.
$EOD
$ create/log ATRDEF.H
$DECK
#define ATR$C_UCHAR 3
#define ATR$S_UCHAR 4
#define ATR$C_RECATTR 4
#define ATR$S_RECATTR 32
#define ATR$C_FILNAM 5
#define ATR$S_FILNAM 6
#define ATR$C_FILTYP 6
#define ATR$S_FILTYP 2
#define ATR$C_FILVER 7
#define ATR$S_FILVER 2
#define ATR$C_EXPDAT 8
#define ATR$S_EXPDAT 7
#define ATR$C_STATBLK 9
#define ATR$S_STATBLK 32
#define ATR$C_HEADER 10
#define ATR$S_HEADER 512
#define ATR$C_BLOCKSIZE 11
#define ATR$S_BLOCKSIZE 2
#define ATR$C_USERLABEL 12
#define ATR$S_USERLABEL 80
#define ATR$C_ASCDATES 13
#define ATR$S_ASCDATES 35
#define ATR$C_ALCONTROL 14
#define ATR$S_ALCONTROL 14
#define ATR$C_ENDLBLAST 15
#define ATR$S_ENDLBLAST 4
#define ATR$C_ASCNAME 16
#define ATR$S_ASCNAME 86
#define ATR$C_CREDATE 17
#define ATR$S_CREDATE 8
#define ATR$C_REVDATE 18
#define ATR$S_REVDATE 8
#define ATR$C_EXPDATE 19
#define ATR$S_EXPDATE 8
#define ATR$C_BAKDATE 20
#define ATR$S_BAKDATE 8
#define ATR$C_UIC 21
#define ATR$S_UIC 4
#define ATR$C_FPRO 22
#define ATR$S_FPRO 2
#define ATR$C_RPRO 23
#define ATR$S_RPRO 2
#define ATR$C_ACLEVEL 24
#define ATR$S_ACLEVEL 1
#define ATR$C_SEMASK 25
#define ATR$S_SEMASK 8
#define ATR$C_UIC_RO 26
#define ATR$S_UIC_RO 4
#define ATR$C_DIRSEQ 27
#define ATR$S_DIRSEQ 2
#define ATR$C_BACKLINK 28
#define ATR$S_BACKLINK 6
#define ATR$C_JOURNAL 29
#define ATR$S_JOURNAL 1
#define ATR$C_HDR1_ACC 30
#define ATR$S_HDR1_ACC 1
#define ATR$C_ADDACLENT 31
#define ATR$S_ADDACLENT 255
#define ATR$C_DELACLENT 32
#define ATR$S_DELACLENT 255
#define ATR$C_MODACLENT 33
#define ATR$S_MODACLENT 255
#define ATR$C_FNDACLENT 34
#define ATR$S_FNDACLENT 255
#define ATR$C_FNDACLTYP 35
#define ATR$S_FNDACLTYP 255
#define ATR$C_FNDACETYP 35
#define ATR$S_FNDACETYP 255
#define ATR$C_DELETEACL 36
#define ATR$S_DELETEACL 255
#define ATR$C_READACL 37
#define ATR$S_READACL 512
#define ATR$C_ACLLENGTH 38
#define ATR$S_ACLLENGTH 4
#define ATR$C_READACE 39
#define ATR$S_READACE 255
#define ATR$C_RESERVED 40
#define ATR$S_RESERVED 380
#define ATR$C_HIGHWATER 41
#define ATR$S_HIGHWATER 4
#define ATR$C_DUMMY_0 42
#define ATR$S_DUMMY_0 4
#define ATR$C_PRIVS_USED 43
#define ATR$S_PRIVS_USED 4
#define ATR$C_MATCHING_ACE 44
#define ATR$S_MATCHING_ACE 255
#define ATR$C_ACCESS_MODE 45
#define ATR$S_ACCESS_MODE 1
#define ATR$C_FILE_SPEC 46
#define ATR$S_FILE_SPEC 512
#define ATR$C_CLASS_MASK 47
#define ATR$S_CLASS_MASK 20
#define ATR$C_BUFFER_OFFSET 48
#define ATR$S_BUFFER_OFFSET 2
#define ATR$C_RU_ACTIVE 49
#define ATR$S_RU_ACTIVE 1
#define ATR$C_MAX_CODE 49
#define ATR$C_MAX_PLUS1 50
#define ATR$S_ATRDEF 8
struct ATRDEF
{
  unsigned short int atr$w_size;
  unsigned short int atr$w_type;
  unsigned long int atr$l_addr;
};
$EOD
$ create/log C.OPT
$DECK
sys$share:vaxcrtl.exe/share
$EOD
$ create/log CLD.H
$DECK
  char *t_rtype = "TYPE";
  char *ta_rtype[] = {
    "UNDEFINED",
    "FIXED",
    "VARIABLE",
    "VFC",
    "STREAM",
    "LFSTREAM",
    "CRSTREAM"
  };
  char *t_fileorg = "ORGANIZATION";
  char *ta_fileorg[] = {
    "SEQUENTIAL",
    "RELATIVE",
    "INDEXED",
    "DIRECT"
  };
  char *t_attr = "ATTRIBUTES";
    char *t_fortrancc = "FORTRANCC";
    char *t_impliedcc = "IMPLIEDCC";
    char *t_printcc = "PRINTCC";
    char *t_nospan = "SPAN";
  char *t_char = "CHARACTERISTICS";
    char *t_badacl = "ACL_CORRUPT";
    char *t_nobackup = "BACKUP";
    char *t_contigb = "BEST_TRY_CONTIGUOUS";
    char *t_nocharge = "CHARGE";
    char *t_contig = "CONTIGUOUS";
    char *t_directory = "DIRECTORY";
    char *t_erase = "ERASE_ON_DELETE";
    char *t_badblock = "FILE_CORRUPT";
    char *t_locked = "LOCKED";
    char *t_markdel = "MARKED_FOR_DELETE";
    char *t_spool = "SPOOL";
    char *t_readcheck = "READ_VERIFY";
    char *t_writeback = "WRITE_BACK";
    char *t_writcheck = "WRITE_VERIFY";
  char *t_vfcsize = "VFC_SIZE";
  char *t_rsize = "RECORD_SIZE";
  char *t_maxrec = "MAXIMUM_RECORD_SIZE";
  char *t_efblk = "END_OF_FILE_BLOCK";
  char *t_ffbyte = "FIRST_FREE_BYTE";
  char *t_hiblk = "HIGHEST_ALLOCATED_BLOCK";
  char *t_defext = "DEFAULT_EXTEND_QUANTITY";
  char *t_bktsize = "BUCKET_SIZE";
  char *t_gbc = "GLOBAL_BUFFER_COUNT";
  char *t_dirvers = "DIRECTORY_VERSION_LIMIT";
  char *t_versions = "VERSION_LIMIT";
  char *t_journal = "JOURNAL";
    char *t_journal_file = "JOURNAL";
    char *t_aijnl = "AIJNL";
    char *t_atjnl = "ATJNL";
    char *t_bijnl = "BIJNL";
    char *t_rujnl = "RUJNL";
    char *t_never_ru = "NEVER_RU";
    char *t_only_ru = "ONLY_RU";
  char *t_credate = "CREATION_DATE";
  char *t_revdate = "REVISION_DATE";
  char *t_expdate = "EXPIRATION_DATE";
  char *t_bakdate = "BACKUP_DATE";
  char *t_revisions = "NUMBER_OF_REVISIONS";
$EOD
$ create/log FATDEF.H
$DECK
#define FAT$K_LENGTH 32
#define FAT$C_LENGTH 32
#define FAT$S_FATDEF 32

struct FATDEF  {
  variant_union  {
    unsigned char fat$b_rtype;
    variant_struct  {
      unsigned fat$v_rtype : 4;
      unsigned fat$v_fileorg : 4;
    } fat$r_rtype_bits;
  } fat$r_rtype_overlay;
# define FAT$S_RTYPE 4
# define FAT$V_RTYPE 0
#   define FAT$C_UNDEFINED 0
#   define FAT$C_FIXED 1
#   define FAT$C_VARIABLE 2
#   define FAT$C_VFC 3
#   define FAT$C_STREAM 4
#   define FAT$C_STREAMLF 5
#   define FAT$C_STREAMCR 6
# define FAT$S_FILEORG 4
# define FAT$V_FILEORG 4
#   define FAT$C_SEQUENTIAL 0
#   define FAT$C_RELATIVE 1
#   define FAT$C_INDEXED 2
#   define FAT$C_DIRECT 3
  variant_union  {
    unsigned char fat$b_rattrib;
    variant_struct  {
      unsigned fat$v_fortrancc : 1;
      unsigned fat$v_impliedcc : 1;
      unsigned fat$v_printcc : 1;
      unsigned fat$v_nospan : 1;
    } fat$r_rattrib_bits;
  } fat$r_rattrib_overlay;
#   define FAT$V_FORTRANCC 0
#   define FAT$M_FORTRANCC 1
#   define FAT$V_IMPLIEDCC 1
#   define FAT$M_IMPLIEDCC 2
#   define FAT$V_PRINTCC 2
#   define FAT$M_PRINTCC 4
#   define FAT$V_NOSPAN 3
#   define FAT$M_NOSPAN 8
  unsigned short int fat$w_rsize;
  variant_union
  {
    unsigned long int fat$l_hiblk;
    variant_struct
    {
      unsigned short int fat$w_hiblkh;
      unsigned short int fat$w_hiblkl;
    } FATDEF$DUMMY_0;
  } FATDEF$DUMMY_1;
  variant_union
  {
    unsigned long int fat$l_efblk;
    variant_struct
    {
      unsigned short int fat$w_efblkh;
      unsigned short int fat$w_efblkl;
    } FATDEF$DUMMY_2;
  } FATDEF$DUMMY_3;
  unsigned short int fat$w_ffbyte;
  unsigned char fat$b_bktsize;
  unsigned char fat$b_vfcsize;
  unsigned short int fat$w_maxrec;
  unsigned short int fat$w_defext;
  unsigned short int fat$w_gbc;
  char fat$fill[8];
  unsigned short int fat$w_versions;
};
$EOD
$ create/log FCHDEF.H
$DECK
#define FCH$V_BADACL    0x00B
#define FCH$M_BADACL    (1 << FCH$V_ACL)
#define FCH$V_BADBLOCK  0x00E
#define FCH$M_BADBLOCK  (1 << FCH$V_BADBLOCK)
#define FCH$V_CONTIG    0x007
#define FCH$M_CONTIG    (1 << FCH$V_CONTIG)
#define FCH$V_CONTIGB   0x005
#define FCH$M_CONTIGB   (1 << FCH$V_CONTIGB)
#define FCH$V_DIRECTORY 0x00D
#define FCH$M_DIRECTORY (1 << FCH$V_DIRECTORY)
#define FCH$V_ERASE     0x011
#define FCH$M_ERASE     (1 << FCH$V_ERASE)
#define FCH$V_LOCKED    0x006
#define FCH$M_LOCKED    (1 << FCH$V_LOCKED)
#define FCH$V_MARKDEL   0x00F
#define FCH$M_MARKDEL   (1 << FCH$V_MARKDEL)
#define FCH$V_NOBACKUP  0x001
#define FCH$M_NOBACKUP  (1 << FCH$V_NOBACKUP)
#define FCH$V_NOCHARGE  0x010
#define FCH$M_NOCHARGE  (1 << FCH$V_NOCHARGE)
#define FCH$V_READCHECK 0x003
#define FCH$M_READCHECK (1 << FCH$V_READCHECK)
#define FCH$V_SPOOL     0x00C
#define FCH$M_SPOOL     (1 << FCH$V_SPOOL)
#define FCH$V_WRITCHECK 0x004
#define FCH$M_WRITCHECK (1 << FCH$V_WRITCHECK)
#define FCH$V_WRITEBACK 0x002
#define FCH$M_WRITEBACK (1 << FCH$V_WRITEBACK)

struct fchdef  {
  unsigned : 1;
  unsigned fch$v_nobackup : 1 ;
  unsigned fch$v_writeback : 1;
  unsigned fch$v_readcheck : 1;
  unsigned fch$v_writcheck : 1;
  unsigned fch$v_contigb : 1;
  unsigned fch$v_locked : 1;
  unsigned fch$v_contig : 1;
  unsigned : 3;
  unsigned fch$v_badacl : 1;
  unsigned fch$v_spool : 1;
  unsigned fch$v_directory : 1;
  unsigned fch$v_badblock : 1;
  unsigned fch$v_markdel : 1;
  unsigned fch$v_nocharge : 1;
  unsigned fch$v_erase : 1;
};
$EOD
$ create/log FIBDEF.H
$DECK
#define FIB$M_NOWRITE 1
#define FIB$M_DLOCK 2
#define FIB$M_BLK_LOCK 4
#define FIB$M_SPOOL 16
#define FIB$M_WRITECK 32
#define FIB$M_SEQONLY 64
#define FIB$M_WRITE 256
#define FIB$M_READCK 512
#define FIB$M_NOREAD 1024
#define FIB$M_NOTRUNC 2048
#define FIB$M_CONTROL 4096
#define FIB$M_EXECUTE 65536
#define FIB$M_PRSRV_ATR 131072
#define FIB$M_RMSLOCK 262144
#define FIB$M_WRITETHRU 524288
#define FIB$M_NOLOCK 1048576
#define FIB$M_NORECORD 2097152
#define FIB$M_REWIND 8
#define FIB$M_CURPOS 16
#define FIB$M_UPDATE 64
#define FIB$K_ACCDATA 10
#define FIB$C_ACCDATA 10
#define FIB$K_DIRDATA 22
#define FIB$C_DIRDATA 22
#define FIB$M_ALLVER 8
#define FIB$M_ALLTYP 16
#define FIB$M_ALLNAM 32
#define FIB$M_WILD 256
#define FIB$M_NEWVER 512
#define FIB$M_SUPERSEDE 1024
#define FIB$M_FINDFID 2048
#define FIB$M_LOWVER 16384
#define FIB$M_HIGHVER 32768
#define FIB$M_ALCON 1
#define FIB$M_ALCONB 2
#define FIB$M_FILCON 4
#define FIB$M_ALDEF 8
#define FIB$M_ALLOCATR 16
#define FIB$M_EXTEND 128
#define FIB$M_TRUNC 256
#define FIB$M_NOHDREXT 512
#define FIB$M_MARKBAD 1024
#define FIB$M_NOCHARGE 32768
#define FIB$K_EXTDATA 32
#define FIB$C_EXTDATA 32
#define FIB$M_EXACT 1
#define FIB$M_ONCYL 2
#define FIB$C_CYL 1
#define FIB$C_LBN 2
#define FIB$C_VBN 3
#define FIB$C_RFI 4
#define FIB$K_ALCDATA 44
#define FIB$C_ALCDATA 44
#define FIB$M_ALT_REQ 1
#define FIB$M_ALT_GRANTED 2
#define FIB$M_DIRACL 4
#define FIB$M_PROPAGATE 8
#define FIB$K_LENGTH 64
#define FIB$C_LENGTH 64
struct fibdef {
    variant_union  {
        unsigned long int fib$l_acctl;
        variant_struct  {
            unsigned fib$v_nowrite : 1;
            unsigned fib$v_dlock : 1;
            unsigned fib$v_blk_lock : 1;
            unsigned fibdef$$_fill_1 : 1;
            unsigned fib$v_spool : 1;
            unsigned fib$v_writeck : 1;
            unsigned fib$v_seqonly : 1;
            unsigned fibdef$$_fill_2 : 1;
            unsigned fib$v_write : 1;
            unsigned fib$v_readck : 1;
            unsigned fib$v_noread : 1;
            unsigned fib$v_notrunc : 1;
            unsigned fib$v_control : 1;
            unsigned fibdef$$_fill_3 : 3;
            unsigned fib$v_execute : 1;
            unsigned fib$v_prsrv_atr : 1;
            unsigned fib$v_rmslock : 1;
            unsigned fib$v_writethru : 1;
            unsigned fib$v_nolock : 1;
            unsigned fib$v_norecord : 1;
            unsigned fibdef$$_fill_4 : 2;
            } fib$r_acctl_bits0;
        variant_struct  {
            unsigned fibdef$$_fill_5 : 3;
            unsigned fib$v_rewind : 1;
            unsigned fib$v_curpos : 1;
            unsigned fibdef$$_fill_6 : 1;
            unsigned fib$v_update : 1;
            unsigned fib$v_fill_1 : 1;
            } fib$r_acctl_bits1;
        variant_struct  {
            char fibdef$$_fill_13 [3];
            char fib$b_wsize;
            } fib$r_acctl_fields2;
        } fib$r_acctl_overlay;
    variant_union  {
        unsigned short int fib$w_fid [3];
        variant_struct  {
            unsigned short int fib$w_fid_num;
            unsigned short int fib$w_fid_seq;
            variant_union  {
                unsigned short int fib$w_fid_rvn;
                variant_struct  {
                    unsigned char fib$b_fid_rvn;
                    unsigned char fib$b_fid_nmx;
                    } fib$r_fid_rvn_fields;
                } fib$r_fid_rvn_overlay;
            } fib$r_fid_fields;
        } fib$r_fid_overlay;
    variant_union  {
        unsigned short int fib$w_did [3];
        variant_struct  {
            unsigned short int fib$w_did_num;
            unsigned short int fib$w_did_seq;
            variant_union  {
                unsigned short int fib$w_did_rvn;
                variant_struct  {
                    unsigned char fib$b_did_rvn;
                    unsigned char fib$b_did_nmx;
                    } fib$r_did_rvn_fields;
                } fib$r_did_rvn_overlay;
            } fib$r_did_fields;
        } fib$r_did_overlay;
    unsigned long int fib$l_wcc;
    variant_union  {
        unsigned short int fib$w_nmctl;
        variant_struct  {
            unsigned fibdef$$_fill_7 : 3;
            unsigned fib$v_allver : 1;
            unsigned fib$v_alltyp : 1;
            unsigned fib$v_allnam : 1;
            unsigned fibdef$$_fill_8 : 2;
            unsigned fib$v_wild : 1;
            unsigned fib$v_newver : 1;
            unsigned fib$v_supersede : 1;
            unsigned fib$v_findfid : 1;
            unsigned fibdef$$_fill_9 : 2;
            unsigned fib$v_lowver : 1;
            unsigned fib$v_highver : 1;
            } fib$r_nmctl_bits;
        } fib$r_nmctl_overlay;
    variant_union  {
        unsigned short int fib$w_exctl;
        variant_struct  {
            unsigned fib$v_alcon : 1;
            unsigned fib$v_alconb : 1;
            unsigned fib$v_filcon : 1;
            unsigned fib$v_aldef : 1;
            unsigned fib$v_allocatr : 1;
            unsigned fibdef$$_fill_10 : 2;
            unsigned fib$v_extend : 1;
            unsigned fib$v_trunc : 1;
            unsigned fib$v_nohdrext : 1;
            unsigned fib$v_markbad : 1;
            unsigned fibdef$$_fill_11 : 4;
            unsigned fib$v_nocharge : 1;
            } fib$r_exctl_bits;
        } fib$r_exctl_overlay;
    unsigned long int fib$l_exsz;
    unsigned long int fib$l_exvbn;
    variant_union  {
        unsigned char fib$b_alopts;
        variant_struct  {
            unsigned fib$v_exact : 1;
            unsigned fib$v_oncyl : 1;
            unsigned fib$v_fill_2 : 6;
            } fib$r_alopts_bits;
        } fib$r_alopts_overlay;
    unsigned char fib$b_alalign;
    variant_union  {
        unsigned short int fib$w_alloc [5];
        variant_struct  {
            variant_union  {
                unsigned short int fib$w_loc_fid [3];
                variant_struct  {
                    unsigned short int fib$w_loc_num;
                    unsigned short int fib$w_loc_seq;
                    variant_union  {
                        unsigned short int fib$w_loc_rvn;
                        variant_struct  {
                            unsigned char fib$b_loc_rvn;
                            unsigned char fib$b_loc_nmx;
                            } fib$r_loc_rvn_fields;
                        } fib$r_loc_rvn_overlay;
                    } fib$r_loc_fid_fields;
                } fib$r_loc_fid_overlay;
            unsigned long int fib$l_loc_addr;
            } fib$r_alloc_fields;
        } fib$r_alloc_overlay;
    unsigned short int fib$w_verlimit;
    unsigned char fib$b_agent_mode;
    char fibdef$$_fill_12;
    unsigned long int fib$l_aclctx;
    unsigned long int fib$l_acl_status;
    variant_union  {
        unsigned long int fib$l_status;
        variant_struct  {
            unsigned fib$v_alt_req : 1;
            unsigned fib$v_alt_granted : 1;
            unsigned fib$v_diracl : 1;
            unsigned fib$v_propagate : 1;
            unsigned fib$v_fill_3 : 4;
            } fib$r_status_bits;
        } fib$r_status_overlay;
    unsigned long int fib$l_alt_access;
    } ;
#define FIB$C_REWINDVOL 1
#define FIB$C_POSEND 2
#define FIB$C_NEXTVOL 3
#define FIB$C_SPACE 4
#define FIB$C_ILLEGAL 5
#define FIB$C_REWINDFIL 6
#define FIB$C_LOCK_VOL 7
#define FIB$C_UNLK_VOL 8
#define FIB$C_ENA_QUOTA 9
#define FIB$C_DSA_QUOTA 10
#define FIB$C_ADD_QUOTA 11
#define FIB$C_EXA_QUOTA 12
#define FIB$C_MOD_QUOTA 13
#define FIB$C_REM_QUOTA 14
#define FIB$C_USEREOT 15
#define FIB$C_REMAP 16
#define FIB$C_CLSEREXCP 17
#define FIB$C_FLUSH_CACHE 18
#define FIB$K_MTALEN 28
#define FIB$C_MTALEN 28
#define FIB$C_FID_CACHE 1
#define FIB$C_EXTENT_CACHE 2
#define FIB$C_QUOTA_CACHE 3
#define FIB$M_ALL_MEM 1
#define FIB$M_ALL_GRP 2
#define FIB$M_MOD_USE 4
#define FIB$M_MOD_PERM 8
#define FIB$M_MOD_OVER 16
struct fibdef1 {
    char fibdef$$_fill_14 [22];
    unsigned short int fib$w_cntrlfunc;
    variant_union  {
        unsigned long int fib$l_cntrlval;
        variant_struct  {
            unsigned fib$v_all_mem : 1;
            unsigned fib$v_all_grp : 1;
            unsigned fib$v_mod_use : 1;
            unsigned fib$v_mod_perm : 1;
            unsigned fib$v_mod_over : 1;
            unsigned fib$v_fill_4 : 3;
            } fib$r_cntrlval_bits;
        } fib$r_cntrlval_overlay;
    } ;

$EOD
$ create/log FILE.C
$DECK
/* FILE.C, a utility to modify file characteristics. Originally written in
   a mix of BASIC and MACRO, it was submitted to the 86 Fall DECUS Tape.
   Recently I rewrote it in C, and added the functionality of my MODIFY
   utility, allowing it to modify creation, expiration, revision, and backup
   dates, as well as the 'number of revisions'. This should demonstrate the
   ease with which such things are modified, thus serving to warn people that
   such things can not always be counted on. Sadly, these should be able to be
   counted on, and one would hope that in a future version of VMS these become
   protected, at the very least from user mode modification.

   Written by Joe Meadows Jr, at the Fred Hutchinson Cancer Research Center
   BITNET: JOE@FHCRCVAX
   PHONE: (206) 467-4970

   There are no restrictions on this code, you may sell it, include it with
   any commercial package, or feed it to a whale... However, I would appreciate
   it if you kept this comment in the source code so that anyone receiving
   this code knows who to contact in case of problems. Note that I do not
   demand this condition..
 */
/* Modifications:
     22-AUG-1987
     Bugfixes (argh!). Fixed output of /NOEXACT, added "-" to first
     line of output. Handle list of file names, as documented.. Make sure
     all lines are under 80 characters, so mailers don't barf.
*/

#include descrip
#include climsgdef
#include rms
#include stdio

#include "atrdef.h"
#include "fatdef.h"
#include "fchdef.h"
#include "fibdef.h"
#include "fjndef.h"
#include "iodef.h"
#include "cld.h"

char *cvt_time();
unsigned int change();
unsigned int antichange();

main()
{
  static struct FAB Fab;
  static struct NAM Nam;
  static struct fibdef Fib; /* short fib */

  static struct dsc$descriptor FibDesc =
    {sizeof(Fib),DSC$K_DTYPE_Z,DSC$K_CLASS_S,&Fib};
  static struct dsc$descriptor_s DevDesc =
    {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.nam$t_dvi[1]};
  static struct FATDEF Fat;
  static union {
    struct fchdef fch;
    long int dummy;
  } uchar;
  static struct fjndef jnl;
  static long int Cdate[2],Rdate[2],Edate[2],Bdate[2];
  static short int revisions;

  static struct ATRDEF Atr[] = {
    sizeof(Fat),ATR$C_RECATTR,&Fat,        /* record attributes */
    sizeof(uchar),ATR$C_UCHAR,&uchar,      /* File characteristics */
    sizeof(Cdate),ATR$C_CREDATE,&Cdate[0], /* Creation date */
    sizeof(Rdate),ATR$C_REVDATE,&Rdate[0], /* Revision date */
    sizeof(Edate),ATR$C_EXPDATE,&Edate[0], /* Expiration date */
    sizeof(Bdate),ATR$C_BAKDATE,&Bdate[0], /* Backup date */
    sizeof(revisions),ATR$C_ASCDATES,&revisions, /* number of revisions */
    sizeof(jnl),ATR$C_JOURNAL,&jnl,        /* journal flags */
    0,0,0
  } ;

  static char EName[NAM$C_MAXRSS];
  static char RName[NAM$C_MAXRSS];
  static struct dsc$descriptor_s FileName =
    {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static short int DevChan;
  static short int iosb[4];

  static long int i,j,status;
  static char *retval;


  while (cli_get_value("P1",&retval) & 1) {
    /* initialize RMS structures, we need a NAM to retrieve the FID */
    Fab = cc$rms_fab;
    Fab.fab$l_fna = retval ; /* name of file */
    Fab.fab$b_fns = strlen(retval);
    Fab.fab$l_nam = &Nam; /* FAB has an associated NAM */
    Nam = cc$rms_nam;
    Nam.nam$l_esa = &EName; /* expanded filename */
    Nam.nam$b_ess = sizeof(EName);
    Nam.nam$l_rsa = &RName; /* resultant filename */
    Nam.nam$b_rss = sizeof(RName);

    /* do $PARSE and $SEARCH here */
    status = sys$parse(&Fab);
    if (!(status & 1)) return(status);

    /* search for the first file.. If none signal error */
    status = sys$search(&Fab);
    if (!(status & 1)) return(status);

    while (status & 1) {
      /* initialize Device name length, note that this points into the NAM
         to get the device name filled in by the $PARSE, $SEARCH services */
      DevDesc.dsc$w_length = Nam.nam$t_dvi[0];

      status = sys$assign(&DevDesc,&DevChan,0,0);
      if (!(status & 1)) return(status);

      FileName.dsc$a_pointer = Nam.nam$l_name;
      FileName.dsc$w_length = Nam.nam$b_name+Nam.nam$b_type+Nam.nam$b_ver;

      /* Initialize the FIB */
      for (i=0;i<3;i++)
        Fib.fib$w_fid[i]=Nam.nam$w_fid[i];
      for (i=0;i<3;i++)
        Fib.fib$w_did[i]=Nam.nam$w_did[i];

      /* Use the IO$_ACCESS function to return info about the file */
      /* Note, used this way, the file is not opened, and the expiration */
      /* and revision dates are not modified */
      status = sys$qiow(0,DevChan,IO$_ACCESS,&iosb,0,0,
                        &FibDesc,&FileName,0,0,&Atr,0);
      if (!(status & 1)) return(status);
      status = iosb[0];
      if (!(status & 1)) return(status);

      if (cli_present("OUTPUT") & 1) {
        /* see if they want output to go to a file or to SYS$OUTPUT */
        status = cli_get_value("OUTPUT",&retval);
        if (status & 1)
          freopen(retval,"w",stdout,"rfm=var","rat=cr");

        /* if it's /noexact, use only name & type part of the result name */
        /* also fudge the resultant file name to have null termination */
        if (cli_present("EXACT") & 1) {
          i = 0;
          j = Nam.nam$b_rsl;
        }
        else {
          i = Nam.nam$b_node + Nam.nam$b_dev + Nam.nam$b_dir;
          j = Nam.nam$b_name+Nam.nam$b_type;
        }
        printf("$ FILE %.*s-\n",j,&RName[i] );

        printf("  /%s=%s",t_rtype,ta_rtype[Fat.fat$v_rtype]);
        printf("  /%s=%s -\n",t_fileorg,ta_fileorg[Fat.fat$v_fileorg]);
        printf("  /%s=(%s%s,%s%s,%s%s,%s%s) -\n",
          t_attr,
          Fat.fat$v_fortrancc?"":"NO",t_fortrancc,
          Fat.fat$v_impliedcc?"":"NO",t_impliedcc,
          Fat.fat$v_printcc?"":"NO",t_printcc,
          Fat.fat$v_nospan?"NO":"",t_nospan);
        printf("  /%s=(%s%s,%s%s,%s%s,%s%s, -\n",
          t_char,
          uchar.fch.fch$v_badacl?"":"NO",t_badacl,
          uchar.fch.fch$v_nobackup?"NO":"",t_nobackup,
          uchar.fch.fch$v_contigb?"":"NO",t_contigb,
         uchar.fch.fch$v_nocharge?"NO":"",t_nocharge);
        printf("    %s%s,%s%s,%s%s,%s%s,%s%s, -\n",
          uchar.fch.fch$v_contig?"":"NO",t_contig,
          uchar.fch.fch$v_directory?"":"NO",t_directory,
          uchar.fch.fch$v_erase?"":"NO",t_erase,
          uchar.fch.fch$v_badblock?"":"NO",t_badblock,
          uchar.fch.fch$v_locked?"":"NO",t_locked);
        printf("    %s%s,%s%s,%s%s,%s%s,%s%s) -\n",
          uchar.fch.fch$v_markdel?"":"NO",t_markdel,
          uchar.fch.fch$v_spool?"":"NO",t_spool,
          uchar.fch.fch$v_readcheck?"":"NO",t_readcheck,
          uchar.fch.fch$v_writeback?"":"NO",t_writeback,
          uchar.fch.fch$v_writcheck?"":"NO",t_writcheck);
        printf("  /%s=%d",t_vfcsize,Fat.fat$b_vfcsize );
        printf("  /%s=%d",t_rsize,Fat.fat$w_rsize );
        printf("  /%s=%d -\n",t_maxrec,Fat.fat$w_maxrec );
        printf("  /%s=%d",t_efblk,(Fat.fat$w_efblkh<<16)|Fat.fat$w_efblkl);
        printf("  /%s=%d -\n",t_ffbyte,Fat.fat$w_ffbyte );
        printf("  /%s=%d -\n",t_hiblk,(Fat.fat$w_hiblkh<<16)|Fat.fat$w_hiblkl);
        printf("  /%s=%d -\n",t_defext,Fat.fat$w_defext );
        printf("  /%s=%d -\n",t_bktsize,Fat.fat$b_bktsize );
        printf("  /%s=%d -\n",t_gbc,Fat.fat$w_gbc );
        printf("  /%s=%d -\n",t_dirvers,Fat.fat$w_versions );
        printf("  /%s=%d -\n",t_versions,Fib.fib$w_verlimit );
        printf("  /%s=(%s%s,%s%s,%s%s,%s%s,%s%s,%s%s,%s%s) -\n",
          t_journal,
          jnl.fjn$v_journal_file?"":"NO",t_journal_file,
          jnl.fjn$v_aijnl?"":"NO",t_aijnl,
          jnl.fjn$v_atjnl?"":"NO",t_atjnl,
          jnl.fjn$v_bijnl?"":"NO",t_bijnl,
          jnl.fjn$v_rujnl?"":"NO",t_rujnl,
          jnl.fjn$v_never_ru?"":"NO",t_never_ru,
          jnl.fjn$v_only_ru?"":"NO",t_only_ru);
        if ((Cdate[0]==0) && (Cdate[1]==0))
          printf("  /NO%s -\n",t_credate);
        else
          printf("  /%s=\"%s\" -\n",t_credate,cvt_time(Cdate));
        if ((Rdate[0]==0) && (Rdate[1]==0))
          printf("  /NO%s",t_revdate);
        else
          printf("  /%s=\"%s\"",t_revdate,cvt_time(Rdate));
        printf("  /%s=%d -\n",t_revisions,revisions);
        if ((Edate[0]==0) && (Edate[1]==0))
          printf("  /NO%s -\n",t_expdate);
        else
          printf("  /%s=\"%s\" -\n",t_expdate,cvt_time(Edate));
        if ((Bdate[0]==0) && (Bdate[1]==0))
          printf("  /NO%s\n",t_bakdate);
        else
          printf("  /%s=\"%s\"\n",t_bakdate,cvt_time(Bdate));
      }; /* if (cli_present("OUTPUT") & 1) */

      if (cli_present(t_rtype) & 1) {
        status = cli_get_value(t_rtype,&retval);
        for (i=0;i<7;i++)
          if (strcmp(retval,ta_rtype[i])==0)
            Fat.fat$v_rtype = i;
      };
      if (cli_present(t_fileorg) & 1) {
        status = cli_get_value(t_fileorg,&retval);
        for (i=0;i<4;i++)
          if (strcmp(retval,ta_fileorg[i])==0)
            Fat.fat$v_fileorg = i;
      };
      Fat.fat$v_fortrancc = change(Fat.fat$v_fortrancc,t_attr,t_fortrancc);
      Fat.fat$v_impliedcc = change(Fat.fat$v_impliedcc,t_attr,t_impliedcc);
      Fat.fat$v_printcc   = change(Fat.fat$v_printcc,t_attr,t_printcc);
      Fat.fat$v_nospan    = antichange(Fat.fat$v_nospan,t_attr,t_nospan);
      uchar.fch.fch$v_badacl = change(uchar.fch.fch$v_badacl,t_char,t_badacl);
      uchar.fch.fch$v_nobackup =
        antichange(uchar.fch.fch$v_nobackup,t_char,t_nobackup);
      uchar.fch.fch$v_contigb =
        change(uchar.fch.fch$v_contigb,t_char,t_contigb);
      uchar.fch.fch$v_nocharge =
        antichange(uchar.fch.fch$v_nocharge,t_char,t_nocharge);
      uchar.fch.fch$v_contig = change(uchar.fch.fch$v_contig,t_char,t_contig);
      uchar.fch.fch$v_directory =
        change(uchar.fch.fch$v_directory,t_char,t_directory);
      uchar.fch.fch$v_erase = change(uchar.fch.fch$v_erase,t_char,t_erase);
      uchar.fch.fch$v_badblock =
        change(uchar.fch.fch$v_badblock,t_char,t_badblock);
      uchar.fch.fch$v_locked = change(uchar.fch.fch$v_locked,t_char,t_locked);
      uchar.fch.fch$v_markdel =
        change(uchar.fch.fch$v_markdel,t_char,t_markdel);
      uchar.fch.fch$v_spool = change(uchar.fch.fch$v_spool,t_char,t_spool);
      uchar.fch.fch$v_readcheck =
        change(uchar.fch.fch$v_readcheck,t_char,t_readcheck);
      uchar.fch.fch$v_writeback =
        change(uchar.fch.fch$v_writeback,t_char,t_writeback);
      uchar.fch.fch$v_writcheck =
        change(uchar.fch.fch$v_writcheck,t_char,t_writcheck);
      if (cli_present(t_vfcsize) & 1) {
        status = cli_get_value(t_vfcsize,&retval);
        Fat.fat$b_vfcsize = atoi(retval);
      };
      if (cli_present(t_rsize) & 1) {
        status = cli_get_value(t_rsize,&retval);
        Fat.fat$w_rsize = atoi(retval);
      };
      if (cli_present(t_maxrec) & 1) {
        status = cli_get_value(t_maxrec,&retval);
        Fat.fat$w_maxrec = atoi(retval);
      };
      if (cli_present(t_efblk) & 1) {
        status = cli_get_value(t_efblk,&retval);
        Fat.fat$w_efblkh = atoi(retval)>>16;
        Fat.fat$w_efblkl = atoi(retval)-Fat.fat$w_efblkh;
      };
      if (cli_present(t_ffbyte) & 1) {
        status = cli_get_value(t_ffbyte,&retval);
        Fat.fat$w_ffbyte = atoi(retval);
      };
      if (cli_present(t_hiblk) & 1) {
        status = cli_get_value(t_hiblk,&retval);
        Fat.fat$w_hiblkh = atoi(retval)>>16;
        Fat.fat$w_hiblkl = atoi(retval)-Fat.fat$w_hiblkh;
      };
      if (cli_present(t_defext) & 1) {
        status = cli_get_value(t_defext,&retval);
        Fat.fat$w_defext = atoi(retval);
      };
      if (cli_present(t_bktsize) & 1) {
        status = cli_get_value(t_bktsize,&retval);
        Fat.fat$b_bktsize = atoi(retval);
      };
      if (cli_present(t_gbc) & 1) {
        status = cli_get_value(t_gbc,&retval);
        Fat.fat$w_gbc = atoi(retval);
      };
      if (cli_present(t_dirvers) & 1) {
        status = cli_get_value(t_dirvers,&retval);
        Fat.fat$w_versions = atoi(retval);
      };
      if (cli_present(t_versions) & 1) {
        status = cli_get_value(t_versions,&retval);
        Fib.fib$w_verlimit = atoi(retval);
        if (Fib.fib$w_verlimit == 0)
          Fib.fib$w_verlimit = 32767;
      };
      /* if this value is illegal, don't try to set it! */
      if (Fib.fib$w_verlimit > 32767)
          Fib.fib$w_verlimit = 0;
      jnl.fjn$v_journal_file =
          change(jnl.fjn$v_journal_file,t_journal,t_journal_file);
      jnl.fjn$v_aijnl = change(jnl.fjn$v_aijnl,t_journal,t_aijnl);
      jnl.fjn$v_atjnl = change(jnl.fjn$v_atjnl,t_journal,t_atjnl);
      jnl.fjn$v_bijnl = change(jnl.fjn$v_bijnl,t_journal,t_bijnl);
      jnl.fjn$v_rujnl = change(jnl.fjn$v_rujnl,t_journal,t_rujnl);
      jnl.fjn$v_never_ru = change(jnl.fjn$v_never_ru,t_journal,t_never_ru);
      jnl.fjn$v_only_ru = change(jnl.fjn$v_only_ru,t_journal,t_only_ru);
      status = cli_present(t_credate);
      if (status & 1) {
        status = cli_get_value(t_credate,&retval);
        bintim(retval,Cdate);
      }
      else
        if (status == CLI$_NEGATED) {
          Cdate[0]=0;
          Cdate[1]=0;
        };
      status = cli_present(t_revdate);
      if (status & 1) {
        status = cli_get_value(t_revdate,&retval);
        bintim(retval,Rdate);
      }
      else
        if (status == CLI$_NEGATED) {
          Rdate[0]=0;
          Rdate[1]=0;
        };
      if (cli_present(t_revisions) & 1) {
        status = cli_get_value(t_revisions,&retval);
        revisions = atoi(retval);
      };
      status = cli_present(t_expdate);
      if (status & 1) {
        status = cli_get_value(t_expdate,&retval);
        bintim(retval,Edate);
      }
      else
        if (status == CLI$_NEGATED) {
          Edate[0]=0;
          Edate[1]=0;
        };
      status = cli_present(t_bakdate);
      if (status & 1) {
        status = cli_get_value(t_bakdate,&retval);
        bintim(retval,Bdate);
      }
      else
        if (status == CLI$_NEGATED) {
          Bdate[0]=0;
          Bdate[1]=0;
        };

      /* note, part of the FIB was cleared by earlier QIOW, so reset it */
      Fib.fib$l_acctl = FIB$M_NORECORD;
      for (i=0;i<3;i++)
        Fib.fib$w_fid[i]=Nam.nam$w_fid[i];
      for (i=0;i<3;i++)
        Fib.fib$w_did[i]=Nam.nam$w_did[i];

      /* Use the IO$_MODIFY function to change info about the file */
      /* Note, used this way, the file is not opened, however this would */
      /* normally cause the expiration and revision dates to be modified. */
      /* Using FIB$M_NORECORD prohibits this from happening. */
      status = sys$qiow(0,DevChan,IO$_MODIFY,&iosb,0,0,
                        &FibDesc,&FileName,0,0,&Atr,0);
      if (!(status & 1)) return(status);

      status = iosb[0];
      if (!(status & 1)) return(status);

      status = sys$dassgn(DevChan);
      if (!(status & 1)) return(status);

      /* look for next file, if none, no big deal.. */
      status = sys$search(&Fab);
      }
  }
}

long int cli_present(s)
  char *s;
{
  static struct dsc$descriptor s_desc = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};

  s_desc.dsc$w_length = strlen(s);
  s_desc.dsc$a_pointer = s;
  return(cli$present(&s_desc));
}

long int cli_get_value(s1,s2)
  char *s1,**s2;
{
  static struct dsc$descriptor s1_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static struct dsc$descriptor s2_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
  static char null = '\0';
  static struct dsc$descriptor null_desc={1,DSC$K_DTYPE_T,DSC$K_CLASS_S,&null};
  long int status;

  s1_desc.dsc$w_length = strlen(s1);
  s1_desc.dsc$a_pointer = s1;

  status = cli$get_value(&s1_desc,&s2_desc);

  if (status & 1)
    {
    str$append(&s2_desc,&null_desc);
    *s2 = s2_desc.dsc$a_pointer;
    }
  else
    *s2 = 0;
  return(status);
}

char *cvt_time(date)
  long int date[2];
{
  static char str[27];
  static struct dsc$descriptor date_str={26,DSC$K_DTYPE_T,DSC$K_CLASS_S,&str};

  if ((date[0]==0) && (date[1]==0))
    return("none");

  sys$asctim(0,&date_str,date,0);
  str[26]='\0';

  return(&str);
}

bintim(time,binval)
  char *time;
  long int binval[2];
{
  static struct dsc$descriptor date_str={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  date_str.dsc$w_length = strlen(time);
  date_str.dsc$a_pointer = time;

  sys$bintim(&date_str,binval);
}

unsigned int change(orig,s1,s2)
  unsigned int orig;
  char *s1,*s2;
{
  static struct dsc$descriptor s1_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static struct dsc$descriptor s2_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static struct dsc$descriptor s3_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
  static char point = '.';
  static struct dsc$descriptor pt_desc={1,DSC$K_DTYPE_T,DSC$K_CLASS_S,&point};
  long int status;
  unsigned int i;

  s1_desc.dsc$w_length = strlen(s1);
  s1_desc.dsc$a_pointer = s1;
  s2_desc.dsc$w_length = strlen(s2);
  s2_desc.dsc$a_pointer = s2;

  /* s3 = s1 + "." + s2 */
  str$copy_dx(&s3_desc,&s1_desc);
  str$append(&s3_desc,&pt_desc);
  str$append(&s3_desc,&s2_desc);

  status = cli$present(&s3_desc);
  i=orig;
  if (status & 1)
    i=1;
  if (status == CLI$_NEGATED)
    i=0;
  return(i);
}

unsigned int antichange(orig,s1,s2)
  unsigned int orig;
  char *s1,*s2;
{
  static struct dsc$descriptor s1_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static struct dsc$descriptor s2_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
  static struct dsc$descriptor s3_desc={0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
  static char point = '.';
  static struct dsc$descriptor pt_desc={1,DSC$K_DTYPE_T,DSC$K_CLASS_S,&point};
  long int status;
  unsigned int i;

  s1_desc.dsc$w_length = strlen(s1);
  s1_desc.dsc$a_pointer = s1;
  s2_desc.dsc$w_length = strlen(s2);
  s2_desc.dsc$a_pointer = s2;

  /* s3 = s1 + "." + s2 */
  str$copy_dx(&s3_desc,&s1_desc);
  str$append(&s3_desc,&pt_desc);
  str$append(&s3_desc,&s2_desc);

  status = cli$present(&s3_desc);
  i=orig;
  if (status & 1)
    i=0;
  if (status == CLI$_NEGATED)
    i=1;
  return(i);
}
$EOD
$ create/log FILE.CLD
$DECK
!*************************************FILE**************************************
define type RECORD_ATTRIBUTES
   keyword FORTRANCC
      negatable
   keyword IMPLIEDCC
      negatable
   keyword PRINTCC
      negatable
   keyword SPAN
      negatable
define type FILE_CHARACTERISTICS
   keyword ACL_CORRUPT
      negatable
   keyword BACKUP
      negatable
   keyword BEST_TRY_CONTIGUOUS
      negatable
   keyword CHARGE
      negatable
   keyword CONTIGUOUS
      negatable
   keyword DIRECTORY
      negatable
   keyword ERASE_ON_DELETE
      negatable
   keyword FILE_CORRUPT
      negatable
   keyword LOCKED
      negatable
   keyword MARKED_FOR_DELETE
      negatable
   keyword READ_VERIFY
      negatable
   keyword SPOOL
      negatable
   keyword WRITE_BACK
      negatable
   keyword WRITE_VERIFY
      negatable
define type JOURNAL_TYPES
   keyword JOURNAL
      negatable
   keyword AIJNL
      negatable
   keyword ATJNL
      negatable
   keyword BIJNL
      negatable
   keyword RUJNL
      negatable
   keyword NEVER_RU
      negatable
   keyword ONLY_RU
      negatable
define type FILE_ORGANIZATION
   keyword DIRECT
   keyword INDEXED
   keyword RELATIVE
   keyword SEQUENTIAL
define type RECORD_TYPE
   keyword CRSTREAM
   keyword FIXED
   keyword LFSTREAM
   keyword STREAM
   keyword UNDEFINED
   keyword VARIABLE
   keyword VFC
define verb FILE
   image FILE
   parameter P1 , prompt="File"
      value (required,list,type=$infile)
   qualifier OUTPUT
      value (type=$outfile)
   qualifier EXACT
      default
   qualifier ATTRIBUTES
      nonnegatable
      value (required,list,type=RECORD_ATTRIBUTES)
   qualifier BUCKET_SIZE
      nonnegatable
      value (required,type=$number)
   qualifier CHARACTERISTICS
      nonnegatable
      value (required,list,type=FILE_CHARACTERISTICS)
   qualifier DEFAULT_EXTEND_QUANTITY
      nonnegatable
      value (required,type=$number)
   qualifier END_OF_FILE_BLOCK
      value (required,type=$number)
   qualifier FIRST_FREE_BYTE
      value (required,type=$number)
   qualifier GLOBAL_BUFFER_COUNT
      value (required,type=$number)
   qualifier HIGHEST_ALLOCATED_BLOCK
      value (required,type=$number)
   qualifier JOURNAL
      nonnegatable
      value (required,list,type=JOURNAL_TYPES)
   qualifier MAXIMUM_RECORD_SIZE
      value (required,type=$number)
   qualifier ORGANIZATION
      value (required,type=FILE_ORGANIZATION)
   qualifier RECORD_SIZE
      value (required,type=$number)
   qualifier TYPE
      value (required,type=RECORD_TYPE)
   qualifier DIRECTORY_VERSION_LIMIT
      value (required,type=$number)
   qualifier VERSION_LIMIT
      value (required,type=$number)
   qualifier VFC_SIZE
      value (required,type=$number)
   qualifier CREATION_DATE
      value (required,type=$datetime)
   qualifier REVISION_DATE
      value (required,type=$datetime)
   qualifier EXPIRATION_DATE
      value (required,type=$datetime)
   qualifier BACKUP_DATE
      value (required,type=$datetime)
   qualifier NUMBER_OF_REVISIONS
      value (required,type=$number)
$EOD
$ create/log FJNDEF.H
$DECK
#define FJN$M_ONLY_RU 1
#define FJN$M_RUJNL 2
#define FJN$M_BIJNL 4
#define FJN$M_AIJNL 8
#define FJN$M_ATJNL 16
#define FJN$M_NEVER_RU 32
#define FJN$M_JOURNAL_FILE 64
#define FJN$S_FJNDEF 1
struct fjndef  {
  unsigned fjn$v_only_ru : 1;
  unsigned fjn$v_rujnl : 1;
  unsigned fjn$v_bijnl : 1;
  unsigned fjn$v_aijnl : 1;
  unsigned fjn$v_atjnl : 1;
  unsigned fjn$v_never_ru : 1;
  unsigned fjn$v_journal_file:1;
} ;
$EOD
$ create/log IODEF.H
$DECK
#define IO$_NOP 0
#define IO$_UNLOAD      1
#define IO$_LOADMCODE   1
#define IO$_SEEK        2
#define IO$_SPACEFILE   2
#define IO$_STARTMPROC  2
#define IO$_RECAL       3
#define IO$_STOP        3
#define IO$_DRVCLR      4
#define IO$_INITIALIZE  4
#define IO$_RELEASE     5
#define IO$_SETCLOCKP   5
#define IO$_OFFSET      6
#define IO$_ERASETAPE   6
#define IO$_STARTDATAP  6
#define IO$_RETCENTER   7
#define IO$_QSTOP       7
#define IO$_PACKACK     8
#define IO$_SEARCH      9
#define IO$_SPACERECORD 9
#define IO$_READRCT     9
#define IO$_WRITECHECK  10
#define IO$_WRITEPBLK   11
#define IO$_READPBLK    12
#define IO$_WRITEHEAD   13
#define IO$_RDSTATS     13
#define IO$_CRESHAD     13
#define IO$_READHEAD    14
#define IO$_ADDSHAD     14
#define IO$_WRITETRACKD 15
#define IO$_COPYSHAD    15
#define IO$_READTRACKD  16
#define IO$_REMSHAD     16
#define IO$_AVAILABLE   17
#define IO$_SETPRFPATH  18
#define IO$_DSE 21
#define IO$_REREADN     22
#define IO$_REREADP     23
#define IO$_WRITERET    24
#define IO$_WRITECHECKH 24
#define IO$_READPRESET  25
#define IO$_STARTSPNDL  25
#define IO$_SETCHAR     26
#define IO$_SENSECHAR   27
#define IO$_WRITEMARK   28
#define IO$_WRTTMKR     29
#define IO$_DIAGNOSE    29
#define IO$_SHADMV      29
#define IO$_FORMAT      30
#define IO$_CLEAN       30
#define IO$_PHYSICAL    31
#define IO$_WRITELBLK   32
#define IO$_READLBLK    33
#define IO$_REWINDOFF   34
#define IO$_SETMODE     35
#define IO$_REWIND      36
#define IO$_SKIPFILE    37
#define IO$_SKIPRECORD  38
#define IO$_SENSEMODE   39
#define IO$_WRITEOF     40
#define IO$_TTY_PORT    41
#define IO$_LOGICAL     47
#define IO$_WRITEVBLK   48
#define IO$_READVBLK    49
#define IO$_ACCESS      50
#define IO$_CREATE      51
#define IO$_DEACCESS    52
#define IO$_DELETE      53
#define IO$_MODIFY      54
#define IO$_NETCONTROL  54
#define IO$_READPROMPT  55
#define IO$_SETCLOCK    55
#define IO$_ACPCONTROL  56
#define IO$_STARTDATA   56
#define IO$_MOUNT       57
#define IO$_TTYREADALL  58
#define IO$_TTYREADPALL 59
#define IO$_CONINTREAD  60
#define IO$_CONINTWRITE 61
#define IO$_VIRTUAL     63
#define IO$M_FCODE      63
#define IO$M_FMODIFIERS 65472
#define IO$M_INHERLOG   2048
#define IO$M_ERASE      1024
#define IO$M_ENCRYPT    8192
#define IO$M_DATACHECK  16384
#define IO$M_INHRETRY   32768
#define IO$M_INHSEEK    4096
#define IO$M_REVERSE    64
#define IO$M_NOWAIT     128
#define IO$M_INHEXTGAP  4096
#define IO$M_MSCPMODIFS 256
#define IO$M_SHADOW     64
#define IO$M_LOCATE     128
#define IO$M_ALLHOSTS   64
#define IO$M_DISSOLVE   128
#define IO$M_NOCLEANUP  256
#define IO$M_SPINDOWN   64
#define IO$M_FORCEPATH  64
#define IO$M_COMMOD     64
#define IO$M_MOVETRACKD 128
#define IO$M_DIAGNOSTIC 256
#define IO$M_SKPSECINH  512
#define IO$M_DELDATA    64
#define IO$M_NOMRSP     64
#define IO$M_SWAP       256
#define IO$M_OPPOSITE   512
#define IO$M_CLSEREXCP  512
#define IO$M_ACCESS     64
#define IO$M_CREATE     128
#define IO$M_DELETE     256
#define IO$M_MOUNT      512
#define IO$M_DMOUNT     1024
#define IO$M_REMOUNT    2048
#define IO$M_BINARY     64
#define IO$M_PACKED     128
#define IO$M_NOW        64
#define IO$M_READATTN   128
#define IO$M_WRTATTN    256
#define IO$M_SETPROT    512
#define IO$M_NORSWAIT   1024
#define IO$M_NOECHO     64
#define IO$M_TIMED      128
#define IO$M_CVTLOW     256
#define IO$M_NOFILTR    512
#define IO$M_DSABLMBX   1024
#define IO$M_PURGE      2048
#define IO$M_TRMNOECHO  4096
#define IO$M_REFRESH    8192
#define IO$M_ESCAPE     16384
#define IO$M_EXTEND     32768
#define IO$M_CANCTRLO   64
#define IO$M_ENABLMBX   128
#define IO$M_NOFORMAT   256
#define IO$M_BREAKTHRU  512
#define IO$M_NEWLINE    1024
#define IO$M_TYPEAHDCNT 64
#define IO$M_MAINT      64
#define IO$M_CTRLYAST   128
#define IO$M_CTRLCAST   256
#define IO$M_HANGUP     512
#define IO$M_OUTBAND    1024
#define IO$M_TT_CONNECT 2048
#define IO$M_TT_DISCON  4096
#define IO$M_TT_PROCESS 8192
#define IO$M_BRDCST     16384
#define IO$M_LOOP       128
#define IO$M_UNLOOP     256
#define IO$M_LINE_OFF   512
#define IO$M_SET_MODEM  1024
#define IO$M_LINE_ON    2048
#define IO$M_LOOP_EXT   4096
#define IO$M_AUTXOF_ENA 8192
#define IO$M_AUTXOF_DIS 16384
#define IO$M_INCLUDE    2048
#define IO$M_TT_ABORT   4096
#define IO$M_INTERRUPT  64
#define IO$M_ABORT      256
#define IO$M_SYNCH      512
#define IO$M_STARTUP    64
#define IO$M_SHUTDOWN   128
#define IO$M_ATTNAST    256
#define IO$M_CTRL       512
#define IO$M_RD_MEM     64
#define IO$M_RD_MODEM   128
#define IO$M_RD_COUNT   256
#define IO$M_CLR_COUNT  1024
#define IO$K_SRRUNOUT   0
#define IO$K_PTPBSC     8192
#define IO$K_LOOPTEST   57344
#define IO$M_MORE       64
#define IO$M_QUALIFIED  128
#define IO$M_REDIRECT   64
#define IO$M_ACCEPT     128
#define IO$M_SETEVF     64
#define IO$M_WORD       64
#define IO$M_SETFNCT    512
#define IO$M_DATAPATH   1024
#define IO$M_CYCLE      4096
#define IO$M_RESET      8192
#define IO$M_SETCUADR   256
#define IO$M_SETBSIZE   512
#define IO$M_SETPOOLSZ  1024
#define IO$M_SETENQCNT  2048
#define IO$M_CLEAR      4096
#define IO$M_LPBEXT     8192
#define IO$M_LPBINT     16384
#define IO$M_READCSR    32768
#define IO$M_NOCTSWAIT  64
#define IO$M_SLAVLOOP   128
#define IO$M_NODSRWAIT  256
#define IO$M_MAINTLOOP  512
#define IO$M_LASTBLOCK  1024
#define IO$M_INTCLOCK   4096
#define IO$S_IODEF      2
#define IO$S_FCODE      6
#define IO$V_FCODE      0
#define IO$S_FMODIFIERS 10
#define IO$V_FMODIFIERS 6
#define IO$V_INHERLOG   11
#define IO$V_ERASE      10
#define IO$V_ENCRYPT    13
#define IO$V_DATACHECK  14
#define IO$V_INHRETRY   15
#define IO$V_INHSEEK    12
#define IO$V_REVERSE    6
#define IO$V_NOWAIT     7
#define IO$V_INHEXTGAP  12
#define IO$V_MSCPMODIFS 8
#define IO$V_SHADOW     6
#define IO$V_LOCATE     7
#define IO$V_ALLHOSTS   6
#define IO$V_DISSOLVE   7
#define IO$V_NOCLEANUP  8
#define IO$V_SPINDOWN   6
#define IO$V_FORCEPATH  6
#define IO$V_COMMOD     6
#define IO$V_MOVETRACKD 7
#define IO$V_DIAGNOSTIC 8
#define IO$V_SKPSECINH  9
#define IO$V_DELDATA    6
#define IO$V_NOMRSP     6
#define IO$V_SWAP       8
#define IO$V_OPPOSITE   9
#define IO$V_CLSEREXCP  9
#define IO$V_ACCESS     6
#define IO$V_CREATE     7
#define IO$V_DELETE     8
#define IO$V_MOUNT      9
#define IO$V_DMOUNT     10
#define IO$V_REMOUNT    11
#define IO$V_BINARY     6
#define IO$V_PACKED     7
#define IO$V_NOW        6
#define IO$V_READATTN   7
#define IO$V_WRTATTN    8
#define IO$V_SETPROT    9
#define IO$V_NORSWAIT   10
#define IO$V_NOECHO     6
#define IO$V_TIMED      7
#define IO$V_CVTLOW     8
#define IO$V_NOFILTR    9
#define IO$V_DSABLMBX   10
#define IO$V_PURGE      11
#define IO$V_TRMNOECHO  12
#define IO$V_REFRESH    13
#define IO$V_ESCAPE     14
#define IO$V_EXTEND     15
#define IO$V_CANCTRLO   6
#define IO$V_ENABLMBX   7
#define IO$V_NOFORMAT   8
#define IO$V_BREAKTHRU  9
#define IO$V_NEWLINE    10
#define IO$V_TYPEAHDCNT 6
#define IO$V_MAINT      6
#define IO$V_CTRLYAST   7
#define IO$V_CTRLCAST   8
#define IO$V_HANGUP     9
#define IO$V_OUTBAND    10
#define IO$V_TT_CONNECT 11
#define IO$V_TT_DISCON  12
#define IO$V_TT_PROCESS 13
#define IO$V_BRDCST     14
#define IO$V_LOOP       7
#define IO$V_UNLOOP     8
#define IO$V_LINE_OFF   9
#define IO$V_SET_MODEM  10
#define IO$V_LINE_ON    11
#define IO$V_LOOP_EXT   12
#define IO$V_AUTXOF_ENA 13
#define IO$V_AUTXOF_DIS 14
#define IO$V_INCLUDE    11
#define IO$V_TT_ABORT   12
#define IO$V_INTERRUPT  6
#define IO$V_ABORT      8
#define IO$V_SYNCH      9
#define IO$V_STARTUP    6
#define IO$V_SHUTDOWN   7
#define IO$V_ATTNAST    8
#define IO$V_CTRL       9
#define IO$V_RD_MEM     6
#define IO$V_RD_MODEM   7
#define IO$V_RD_COUNT   8
#define IO$V_CLR_COUNT  10
#define IO$V_MORE       6
#define IO$V_QUALIFIED  7
#define IO$V_REDIRECT   6
#define IO$V_ACCEPT     7
#define IO$V_SETEVF     6
#define IO$V_WORD       6
#define IO$V_SETFNCT    9
#define IO$V_DATAPATH   10
#define IO$V_CYCLE      12
#define IO$V_RESET      13
#define IO$V_SETCUADR   8
#define IO$V_SETBSIZE   9
#define IO$V_SETPOOLSZ  10
#define IO$V_SETENQCNT  11
#define IO$V_CLEAR      12
#define IO$V_LPBEXT     13
#define IO$V_LPBINT     14
#define IO$V_READCSR    15
#define IO$V_NOCTSWAIT  6
#define IO$V_SLAVLOOP   7
#define IO$V_NODSRWAIT  8
#define IO$V_MAINTLOOP  9
#define IO$V_LASTBLOCK  10
#define IO$V_INTCLOCK   12
$EOD
$ say = "WRITE SYS$OUTPUT"
$ say "Compiling FILE"
$ cc file
$ say "Linking FILE"
$ link/notrace file,c/option
$ type sys$input
  FILE is now built, you may either edit FILE.CLD to point to where the
  image is located, or you may DEFINE FILE to point to the FILE program.
  After you have done this, do SET COMMAND FILE, and you'll be set!

  Send comments, inquiries etc. to:
  Joe Meadows Jr.
  Fred Hutchinson Cancer Research Center
     bitnet - JOE@FHCRCVAX
     arpa   - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU
     voice  - (206) 467-4970
$ exit
