From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 28-OCT-1988 12:42
To:	ARISIA::EVERHART
Subj:	RE: Re: File specification regularity (Was: Re: VMS vs. UNIX file


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 28 OCT 88 00:02:42 PDT
Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Thu, 27 Oct 88 23:43:20 PDT
Received: from UALR.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 3869; Fri, 28 Oct 88 02:29:33 EDT
Date: Thu, 27 Oct 88 17:15 CDT
From: Dale Miller <DOMILLER%UALR.BITNET@CUNYVM.CUNY.EDU>
Subject: RE: Re: File specification regularity (Was: Re: VMS vs. UNIX file
 system)
To: INFO-VAX@KL.SRI.COM
X-VMS-To: IN%"INFO-VAX@KL.SRI.COM"

Date sent:  27-OCT-1988 17:10:12
Rahul Dhesi <bsu-cs!dhesi@IUVAX.CS.INDIANA.EDU>  writes:
>
>This reminds me that I was driven up the wall by LIB$FIND_FILE's
>insistence on expanding the wildcarded filespec (e.g, "*.c") into a
>complete filespec, including all the fields that I didn't ask for, such
>as device, directory, and version number.  If I specify "*.c", I would
>really prefer to see expanded names such as "xyz.c", "abc.c", etc., not
>names such like "DISK$[DIR.SUBDIR.SUBDIR]FILENAME.C;VER", which
>LIB$FIND_FILE returns.
>
>Still looking for a solution.
>--
>Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
>
The solution is not clean, but it works - SYS$FILESCAN.
the following program demonstrates 2 ways of providing the string you want.
The infuriating 'feature' of this service is that it returns the address of
the component rather that the offset into the string.  Since FORTRAN doesn't
like raw addresses, you have to play some games to get the proper result.
---------------------------- CUT HERE -----------------------------------------
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c       TEST.FOR
c       This program demonstrates SYS$FILESCAN
c       Dale Miller - University of Arkansas at Little Rock
c       DOMILLER@UALR.BITNET
c       This package is placed in the public domain.  You may freely transfer
c       it to any interested party.
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
        implicit none
        include     '($ssdef)'
        include     '($rmsdef)'
        include     '($fscndef)'
        character   filename*128,outname*128
        integer     istat,filename_len,offset,context
        integer     lib$find_file
        structure       /scnlst/
            union
                map
                    integer*2   component_len
                    integer*2   item_code
                    integer*4   component_address
                    end map
                map
                    integer*4   end_list
                    end map
                end union
            end structure

        record/scnlst/     filescan_list(3)

        filescan_list(1).item_code = fscn$_name
        filescan_list(2).item_code = fscn$_type
        filescan_list(3).end_list = 0
        context=0
        istat = lib$find_file('*.com',filename,context,,,,)
        do while (istat.eq.rms$_normal)
            call sys$filescan(filename,filescan_list,)
            filename_len = filescan_list(1).component_len+
        1       filescan_list(2).component_len
            offset = filescan_list(1).component_address - %loc(filename) + 1
            print*,'try1='//filename(offset:offset+filename_len-1)
            call str$copy_r (outname,filename_len,
        1       %val(filescan_list(1).component_address))
            print*,'try2='//outname(1:filename_len)
            istat = lib$find_file('*.com',filename,context,,,,)
            end do
        end
--------------------------------------------------------------------------
When run against my root directory, I get the following list:
%PHOTO-I-INIT, Recording initiated at 27-OCT-1988 17:08:05.34
$run test
try1=GMAILUPD.COM
try2=GMAILUPD.COM
try1=LOGIN.COM
try2=LOGIN.COM
try1=REPDIS.COM
try2=REPDIS.COM
try1=RESET_UAMS.COM
try2=RESET_UAMS.COM
try1=RESTORE.COM
try2=RESTORE.COM
$
--------------------------------------------------------------------------
| Dale O. Miller                        | #   #  ###  #     ####         |
| University of Arkansas at Little Rock | #   # #   # #     #   #        |
| 2801 S. University                    | #   # ##### #     ####         |
| Little Rock, AR  72204-1099  USA      | #   # #   # #     #  #         |
| (501)569-8714                         |  ###  #   # ##### #   #        |
| DOMILLER@UALR.BITNET                  | Disclaimer: This does not      |
| 92-20-28 W,34-43-30 N.ICBMNET         | say what I say it doesn't say. |
--------------------------------------------------------------------------

