HP3000-L Archives

May 2001, Week 5

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:
Donna Garverick <[log in to unmask]>
Reply To:
Donna Garverick <[log in to unmask]>
Date:
Wed, 30 May 2001 17:41:32 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (218 lines)
hi!

ok...so it seems no one has written anything to create an
index...until now :-)  this 'thing' is composed of two
scripts rather brilliantly (if i do say so :-) named mkindx
and mkindx2.  mkindx calls/runs mkindx2.  mkindx can be
renamed to whatever you want, but the reference to mkindx2
is hardcoded....

given how i've got apache configured, this works in my
environment.  you may need to adjust the file references
(paths) in mkindx2.  it also runs 'chmod' -- not
chmod.hpbin.sys.  .hpbin.sys in part of hppath for me.
(watch for any line wrap...especially in mkindx2)        - d

mkindx
-------
anyparm path=/APACHE/PUB/html/mpe/cicat

setvar _mi_path "!path"

if _mi_path = "?"
  echo
  echo word(hpfile,'.') [path]
  echo
  echo This script is designed to produce an index.html in
  echo the given directory.  Typically, this directory
should
  echo contain other .html files that have no central
indexing
  echo method.  Specifically, the perl script 'cicat2html'
  echo produces a collection of .html files based on the
contents
  echo of CICat.Pub.Sys.  While it's a wonderful thing, it
lacks
  echo the creation of index.html.  This script remedies
that.
  deletevar _mi@
  return
endif

if pos('@',_mi_path) = 0
  if rht(_mi_path,1) <> '/'
    setvar _mi_path2 _mi_path+'/@'
  else
    setvar _mi_path2 _mi_path+'@'
  endif
endif

if finfo("!_mi_path/index.html","exists")
  purge !_mi_path/index.html
endif

purge mitemp,temp >$null
listfile !_mi_path2,6 > mitemp

setvar cjcw 0
grep "-i 'Non-existent'" < mitemp > $null
#--- cjcw = 0 means the above string was found
if cjcw = 0
  echo
  echo ERROR: ListFile of !_mi_path appears to have failed
  print mitemp
  return
endif

#--- because this script uses anyparm, call a 2nd script to
do
#--- the real work
mkindx2 < mitemp

if finfo("!_mi_path/index.html","exists")
  chmod "644 !_mi_path/index.html"
  purge mitemp,temp > $null
  deletevar _mi_@
else
  echo
  echo ERROR:  !_mi_path/index.html was not created
endif

mkindx2
--------
#--- build the index.html file as bytestream
build !_mi_path/index.html;rec=-1,,b,ascii;disc=15000000
file x=!_mi_path/index.html,old;acc=append

#--- the brackets for html tags cause all sorts of
headaches...
#--- so put them into ci variables (la = left angle and
ra=right angle)
setvar _mi_la '!<'
setvar _mi_ra '!>'

#--- start building the index page
#--- notice how _mi_la is quoted...the ending quote avoids
having to insert a sp
ace (cool)
echo !"_mi_la"html!_mi_ra >>*x
echo !"_mi_la"head!_mi_ra >>*x
echo !"_mi_la"title!_mi_ra >>*x
echo    Index of all Commands and Variables >>*x
echo !"_mi_la"/title!_mi_ra >>*x
echo !"_mi_la"/head!_mi_ra >>*x
echo !"_mi_la"body!_mi_ra >>*x
echo !"_mi_la"a name="_top_"!_mi_ra!"_mi_la"/a!_mi_ra >>*x
echo !"_mi_la"hr!_mi_ra >>*x
echo !"_mi_la"a href="#thumb-a"!_mi_ra a!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-b"!_mi_ra b!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-c"!_mi_ra c!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-d"!_mi_ra d!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-e"!_mi_ra e!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-f"!_mi_ra f!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-g"!_mi_ra g!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-h"!_mi_ra h!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-i"!_mi_ra i!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-j"!_mi_ra j!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-k"!_mi_ra k!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-l"!_mi_ra l!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-m"!_mi_ra m!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-n"!_mi_ra n!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-o"!_mi_ra o!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-p"!_mi_ra p!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-q"!_mi_ra q!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-r"!_mi_ra r!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-s"!_mi_ra s!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-t"!_mi_ra t!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-u"!_mi_ra u!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-v"!_mi_ra v!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-w"!_mi_ra w!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-x"!_mi_ra x!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-y"!_mi_ra y!"_mi_la"/a!_mi_ra
>>*x
echo !"_mi_la"a href="#thumb-z"!_mi_ra z!"_mi_la"/a!_mi_ra
>>*x
echo  >>*x
echo !"_mi_la"hr!_mi_ra >>*x
echo !"_mi_la"h1!_mi_ra >>*x
echo   Index of all Commands and Variables >>*x
echo !"_mi_la"/h1!_mi_ra >>*x

setvar _mi_alphabet 'abcdefghijklmnopqrstuvwxyz'
setvar _mi_1st ''
setvar _mi_i 0

setvar _mi_eof1 finfo(HPSTDIN,"eof")
while setvar(_mi_eof1,_mi_eof1-1) >= 0
  input _mi_rec
#--- extract 'filename.html' from the end of the record
  setvar _mi_file word(_mi_rec,'/',wordcnt(_mi_rec,'/'))
#--- 1st is really 1st letter....
  while _mi_1st < lft(_mi_file,1)
    setvar _mi_i _mi_i + 1
    setvar _mi_1st str(_mi_alphabet,_mi_i,1)
#--- echo to stdlist just so we know the script is running
    echo !_mi_1st
#--- a little control break logic
    if _mi_1st > 'a'
      echo !"_mi_la"dd!_mi_ra !"_mi_la"a
href="#_top_"!_mi_ra back to the top!"_
mi_la"/a!_mi_ra >>*x
      echo !"_mi_la"/dl!_mi_ra >>*x
    endif
    echo !"_mi_la"a
name="thumb-!_mi_1st"!_mi_ra!_mi_la/a!_mi_ra >>*x
    echo !"_mi_la"h2!_mi_ra >>*x
    echo !"_mi_la"a name="thumb-!_mi_1st"!_mi_ra !_mi_1st
!_mi_la/a!_mi_ra >>*x
    echo !_mi_la/h2!_mi_ra >>*x
    echo !"_mi_la"dl!_mi_ra >>*x
  endwhile
#--- (w/o the brackets...) dt a href="filename.html"
filename /a
  echo !"_mi_la"dt!_mi_ra !"_mi_la"a
href="!_mi_file"!_mi_ra![word(_mi_file,'.')
]!_mi_la/a!_mi_ra >>*x
endwhile
#--- a little wrap up
echo !"_mi_la"/dl!_mi_ra >>*x
echo !"_mi_la"/body!_mi_ra >>*x
echo !"_mi_la"/html!_mi_ra >>*x

--
Donna Garverick     Sr. System Programmer
925-210-6631        [log in to unmask]

"Unix _is_ user friendly.
It's just very selective about who its friends are.
And sometimes even best friends have fights."

>>>MY opinions, not Longs Drug Stores'<<<

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2