HP3000-L Archives

October 1997, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jeff Vance <[log in to unmask]>
Reply To:
Jeff Vance <[log in to unmask]>
Date:
Tue, 21 Oct 1997 09:58:19 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (106 lines)
On Oct 20,  3:38pm, James Reynolds wrote:
> Subject: No subject given
>      Is there a efficient, programmatic way to find a file on the HP3000?
>
>      We use LISTF "file.group.@" and

LISTFILE start,6;seleq=[object=FILE];name=name_youre_looking_for
is another way to find files in the hierarchical directory (works for
MPE-named files too).  The FINDFILE UDC in the hppxudc.pub.sys file
shows more details.

>      FINFO("file.group.@","exists) and

nit: FINFO does not support wildcarding.

>      Is there someway to find a file programmatically via HPPATH without
>      executing it?
>
>      or the same way HELP "file" finds the "file" - instantly - and without
>      the overhead of one of the above commands?

I wrote a command file that uses HPPATH to locate a file, similar to
the unix "which" command.  It handles group[.acct] and directory HPPATH
elements.  Here it is the script named FIND:

PARM file, cmd=''
ANYPARM args=![""]
# This command file locates a file based on HPPATH.
# If 'cmd' is not empty then it will be executed and passed 'file' and 'args'
# as parameters.
if len(hppath) = 0 then
   echo HPPATH is empty!
   return
endif

setvar _find_file "!file"
setvar _find_i 0
setvar _find_done false

while not (_find_done) and _find_i < len(hppath) do
   setvar _find_qualifier word(hppath,", ;",,_find_i,_find_i+1)
   if _find_qualifier <> '' then
      if lft(_find_qualifier,1) = '.' or lft(_find_qualifier,1) = '/' then
         # posix path element -- append filename
         setvar _find_fullname _find_qualifier+"/"+_find_file
      else
         # mpe path element -- prepend filename
         setvar _find_fullname _find_file+"."+_find_qualifier
      endif
      # see if file exists
      if finfo(_find_fullname,'exists') then
         # found file
         setvar _find_done true
         echo !_find_fullname
         # see if 'cmd' should be executed
         if '!cmd' <> '' then
            echo
            echo Invoking !cmd...
            continue
            !cmd !_find_fullname !args
         endif
      endif
   endif
endwhile

#  see if we found the file
if not _find_done then
   echo Could not locate !_find_file using your HPPATH.
   echo HPPATH = !hppath
endif
deletevar _find_@


Examples:

  :find spook
  spook.PUB.SYS

  :find cg print
  cg.scripts.sys

  Invoking print...
  parm group=''
  chgroup !group

  :find hped
  /JVNM/PUB/bin/hped

  :find nothing
  Could not locate nothing using your HPPATH.
  HPPATH = PUB,PUB,PUB.SYS,ARPA.SYS,/JVNM/PUB/bin,scripts.sys ./bin

regards,
Jeff Vance, CSY


--





---End of forwarded mail from [log in to unmask]

--

ATOM RSS1 RSS2