home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / bbs102e.zip / bbsrecnt.cmd < prev    next >
OS/2 REXX Batch file  |  1997-10-15  |  21KB  |  717 lines

  1. /* Create an "index list" of files recently added to the bbs files area
  2. (during the last n days).  This index will contain the "url" to
  3. the file, the size and date, an optional description, and the required privileges.
  4. BBS can read, and display, these "index lists".
  5.  
  6. The following information is saved to the "stem" file (i.e. BBSRECNT.IDX):
  7.           .0 = # entries (N)
  8.           .!hdrfile = Optional header file
  9.           .!header = Generic header, used if hdrfile not specified
  10.           .!ftrfile = Optional footer file
  11.           .!title = Optional title
  12.           .!filedir = Root directory
  13.           .!days = oldest file parameter
  14.           .n = file name (relative to .!filedir).
  15.                Or, if =' ', then "it's a comment".
  16.           .n.!Ndate =normal date
  17.           .n.!time = 24hr time
  18.           .n.!size = size in bytes
  19.           .n.!jdate = julian date
  20.           .n.!privs= privileges required (* means "open access")
  21.           .n.!desc = description
  22. If you are ambitious, you can write your own routines. As long as they
  23. generate the above information, everything else is up to you. Note
  24. that you'll need to use the CVWRITE function to write the "stem" file.
  25.  
  26.  
  27.  
  28.                  **** IMPORTANT INSTALLATION NOTE ***
  29.  
  30.    A BBS.INI file MUST exist in the same directory BBS.CMD is installed to. 
  31.  
  32.  
  33.  */
  34.  
  35. /*A few User changeable non bbs.ini  parameters ... */
  36.  
  37. imagesize="width=24 height=24"   /* size of icons */
  38.  
  39.  
  40. verbose=1                       /* verbose=1  for verbose reporting */
  41.  
  42.  
  43. /*--------------   Load REXX libraries ----- */
  44. /* Load up advanced REXX functions */
  45. foo=rxfuncquery('sysloadfuncs')
  46. if foo=1 then do
  47.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  48.   call SysLoadFuncs
  49. end
  50. foo=rxfuncquery('rexxlibregister')
  51. if foo=1 then do
  52.  call rxfuncadd 'rexxlibregister','rexxlib', 'rexxlibregister'
  53.  call rexxlibregister
  54. end
  55.  
  56.  
  57. /* some color stuff */
  58. ansion=checkansi()
  59. if ansion=1 then do
  60.   aesc='1B'x
  61.   cy_ye=aesc||'[37;46;m'
  62.   normal=aesc||'[0;m'
  63.   bold=aesc||'[1;m'
  64.   re_wh=aesc||'[31;47;m'
  65.   reverse=aesc||'[7;m'
  66. end
  67. else do
  68.   cy_ye="" ; normal="" ; bold="" ;re_wh="" ; 
  69.   reverse=""
  70. end  /* Do */
  71.  
  72. /* current directory is base directory */
  73. basedir=directory()
  74. basedir=strip(basedir,'t','\')||'\'
  75.  
  76. crlf='0d0a'x
  77.  
  78.  
  79. call load_rxl
  80.  
  81. inifile=basedir||'bbs.ini'
  82. isit=fileread(inifile,inilines,,'E')
  83. if isit<0 then do
  84.      say " ERROR: no BBS initialization file:" inifile
  85.      exit
  86. end  /* Do */
  87.  
  88. signal on syntax name bad1
  89. signal on error name bad1
  90. mm=0
  91.  
  92. gobot:
  93. mm=mm+1
  94. if mm > inilines.0 then signal good1
  95. aline=inilines.mm
  96. interpret aline
  97. signal gobot
  98.  
  99. bad1:
  100. signal off error ; signal off syntax ;
  101. say " ERROR: error in BBS initialization file: " aline
  102. exit
  103.  
  104. /* ------  bbs_ini okay, or skipped.  Check, various values, directories */
  105. /* this is a shortened version of what's in bbs.cmd */
  106. good1:
  107.  
  108. signal off error ; signal off syntax ;
  109. bbs_param=translate(bbs_param_dir,'\','/')
  110. if abbrev(strip(bbs_param,'l','\'),'\') =0 & pos(':',bbs_param)=0 then /* must be relative dir*/
  111.    bbsdir=basedir||bbs_param||'\'
  112. else
  113.    bbsdir=strip(bbs_param,'t','\')'\'
  114.  
  115. if dosisdir(strip(bbsdir,'t','\'))=0 then do
  116.      say " ERROR: no BBS parameters directory:" bbsdir
  117.     exit
  118. end
  119.  
  120. file_dir=strip(file_dir,'t','\')||'\'
  121.  
  122. ctlfile=stream(bbsdir||'BBS.CTL','c','query exists') /* blank means none */
  123. inctl=0
  124. if ctlfile<>' ' then inctl=get_ctlfile(ctlfile,verbose) /*returns ctls. global */
  125.  
  126. /* a time  date stamp */
  127.  d1=date('b')
  128.  t1=time('m')/(24*60)
  129.  nowtime=d1+t1
  130.  
  131. if symbol('USE_SERVERNAME')<>'VAR' then do
  132.    servername=get_hostname()
  133. end
  134. else do
  135.   if  use_servername="" | use_servername=0 then 
  136.       servername=get_hostname()
  137.   else
  138.      servername=use_servername
  139. end
  140.  
  141. say " "
  142.  
  143. /* ------- End of parameter initializations ------------ */
  144.  
  145.  
  146.  
  147. say "          " cy_ye " This is the BBS recent-files-index creator." normal
  148. say  " The recent-files-index is used to generate a list of recent uploads "
  149. say " "
  150. say " Note-- base directory is: "  bold basedir normal
  151. say "        parameters directory is: " bold bbsdir normal
  152. say "        access control file is: " bold ctlfile normal "(" inctl " entries )"
  153. SAY "        using servername: " bold  servername normal
  154.  
  155. gunky1:
  156. say " "
  157. call charout,  bold " Enter the directory  to find new files in (and under) " normal crlf
  158. call charout,"  ENTER= " file_dir  " ? "
  159. parse pull afile_dir
  160. if afile_dir="" then afile_dir=file_dir
  161. foo=dosisdir(strip(afile_dir,'t','\'))
  162. if foo=0 then do
  163.     say " Could not find directory: " afile_dir
  164.     signal gunky1
  165. end
  166. idxlist.!filedir=afile_dir
  167. say " "
  168.  
  169. boof:
  170. say " "
  171. call charout, reverse " Enter time span  (in days) of files to add to the index " normal crlf
  172. call charout,          '     (files older then this will not be included): '
  173. parse pull daysback
  174. if datatype(daysback)<>'NUM' | daysback="" then  signal boof
  175. idxlist.!days=daysback
  176.  
  177. getidx:
  178. say " "
  179. call charout, reverse " Enter name to use for the recent-files index " normal crlf
  180. call charout,          '  ENTER = BBSRECNT.IDX ? '
  181. parse pull idxfile
  182. if idxfile="" then idxfile="BBSRECNT.IDX"
  183. foos=stream(idxfile,'c','query exists')
  184. if foos<>' ' then
  185.    if yesno('     ' idxfile' exists. Overwrite? ')= 0 then signal getidx
  186.  
  187.  
  188. say " "
  189. sortbydate=yesno(" Sort by date (with most recent first)")
  190. dir_seps=0
  191. if sortbydate=0 then do
  192.    dir_seps=yesno("       ... include directory labels in the listing")
  193. end
  194. say " "
  195.  
  196. gethdr:
  197. foos="";aheader=""
  198. say " "
  199. call charout, reverse " Enter name of a header file (default is a generic header) " normal crlf
  200. call charout,          ' ? '
  201. parse pull  hdrfile
  202. if hdrfile<>" " then do
  203.    foos=stream(hdrfile,'c','query exists')
  204.    if foos=' ' then do
  205.       say " File does not exist " hdrfile ". Please re-enter "
  206.       signal gethdr
  207.   end  /* Do */
  208. end
  209. else do
  210.    say "You can modify the " reverse " generic " normal " header."
  211.    say "The header is currently (note the use of HTML elements): "
  212.    eek.1=' <body> <h2> Recent Files from: ' afile_dir '</h2>'
  213.    d2=date('n')
  214.    d1=date('b'); d1=d1-daysback ; d1=dateconv(d1,'b','n')
  215.    eek.2= "<em> Includes files created from " d1 "to" d2  " </em><br>"
  216.    say cy_ye "--> " normal eek.1
  217.    say cy_ye "--> " normal eek.2
  218.    say " You can modify or add to this header. Just hit " bold " ESC " normal " when done"
  219.    say  bold "   ... and be sure to start with a <BODY  > element! " normal
  220.    ili=0
  221.    do forever
  222.     ili=ili+1
  223.     cdo=' '
  224.     if ili<3 then cdo=eek.ili
  225.     call charout, cy_ye"  " normal
  226.     eek.ili=stringin(,6,cdo,74)
  227.     say " "
  228.     if eek.ili="" then leave
  229.    end /* do */
  230.    do mm=1 to ili
  231.       aheader=aheader||eek.mm||crlf
  232.    end /* do */
  233. end  /* Do */
  234. idxlist.!hdrfile=foos
  235. idxlist.!header=aheader
  236. say " "
  237.  
  238. getftr:
  239. foos=""
  240. say " "
  241. call charout, reverse " Enter name of a footer file (default is no footer) " normal crlf
  242. call charout,          ' ? '
  243. parse pull  ftrfile
  244. if ftrfile<>" " then do
  245.    foos=stream(ftrfile,'c','query exists')
  246.    if foos=' ' then do
  247.      say " File does not exist " ftrfile ". Please re-enter "
  248.      signal getftr
  249.    end  /* Do */
  250. end
  251. idxlist.!ftrfile=foos
  252. say " "
  253.  
  254. say " "
  255. call charout, reverse " Enter a title (it will be used in the <TITLE> ):  " normal crlf
  256. atitle="BBS: Latest files "
  257. call charout, cy_ye"  " normal
  258. atitle=stringin(,6,atitle,74)
  259. idxlist.!title=atitle
  260. say " "
  261.  
  262. say " "
  263.  
  264. foo=sysfiletree(afile_dir'*.*',gots,'FST')
  265. exlist=" " ; was_dir=" "
  266. isin=0 ; nexcluded=0
  267. notesgen.!did=0
  268.  
  269. snobal=0
  270. kfiles=0
  271. do mm=1 to gots.0
  272.    snobal=snobal+1
  273.    if (snobal)//101=100 then say " reading line " mm
  274.    parse var gots.mm tim siz . nam
  275.    parse var tim yr '/' mo '/' da '/' hr '/' min .
  276.    jdate=dateconv(yr'/'mo'/'da,'O','B')
  277.    if jdate+daysback < nowtime then iterate
  278.  
  279. /* if new directory, then get exclusion_file list and get description file */
  280.    gets=strip(filespec('d',nam)||filespec('p',nam),'t','\')
  281.    if was_dir <> gets then do
  282.         say " Examining files in: " gets
  283.         reldir='/'||translate(substr(gets,length(afile_dir)+2),'/','\')
  284.         was_dir=gets
  285.         exlist=get_exclusion(gets,verbose)
  286.         exlist=translate(exlist,'\','/')
  287.         oo=make_dsc_descriptions(gets,verbose)
  288.         if dir_seps=1 then do
  289.              isin=isin+1; 
  290.              idxlist.isin=' ';idxlist.isin.!desc='<u>'reldir'</u>'
  291.              idxlist.isin.!jdate=18888888
  292.         end  /* Do */
  293.         snobal=1
  294.    end
  295.  
  296.     nam0=filespec('n',nam)
  297. /* if matches exlist, then skip */
  298.     if is_excluded(nam0,exlist) then do
  299.       nexcluded=nexcluded+1
  300.       if verbose>0 then say "    :: Excluding: " nam0
  301.       iterate
  302.     end
  303.    isin=isin+1 ; kfiles=kfiles+1
  304.    idxlist.isin=translate(substr(nam,length(afile_dir)+2),'/','\')
  305.    idxlist.isin.!privs=fig_access(idxlist.isin)
  306.    idxlist.isin.!jdate=jdate
  307.    idxlist.isin.!size=siz
  308.    idxlist.isin.!ndate=dateconv(yr'/'mo'/'da,'O','N')
  309.    idxlist.isin.!time=hr':'min
  310.    idxlist.isin.!desc=find_description(nam0)
  311. /* information saved: .n = file name (relative to afile_dir
  312.                       .n.!Ndate =normal date
  313.                       .n.!time = 24hr time
  314.                       .n.!size = size in bytes
  315.                       .n.!jdate = julian date
  316.                       .n.!privs= privileges required
  317. */
  318. end /* do */
  319. idxlist.0=isin
  320.  
  321. say " # excluded files= " nexcluded
  322. say " # retained files = " kfiles
  323. say " # entries (including comments)= " isin
  324. /* now sort it ?*/
  325. if sortbydate=1 then do  /* by date */
  326.    booger.0=isin
  327.    do jj=1 to isin
  328.         booger.jj=left(idxlist.jj.!jdate,30) ','  idxlist.jj ',' ,
  329.                       idxlist.jj.!ndate  ',' idxlist.jj.!time  ',' ,
  330.                       idxlist.jj.!size  ',' idxlist.jj.!privs
  331.    end
  332.    foo=arraysort(booger,1,,1,30,'D','N')
  333.    do jj=1 to isin
  334.         parse var booger.jj idxlist.jj.!jdate ',' idxlist.jj ',' ,
  335.                       idxlist.jj.!ndate  ',' idxlist.jj.!time  ',' ,
  336.                       idxlist.jj.!size  ',' idxlist.jj.!privs
  337.         idxlist.jj=strip(idxlist.jj) 
  338.         idxlist.jj.!jdate=strip(idxlist.jj.!jdate)
  339.         idxlist.jj.!ndate=strip(idxlist.jj.!ndate)
  340.         idxlist.jj.!time=strip(idxlist.jj.!time)
  341.         idxlist.jj.!privs=strip(idxlist.jj.!privs)
  342.         idxlist.jj.!size=strip(idxlist.jj.!size)
  343.    end /* do */
  344. end  /* Do */
  345.  
  346. say " Number of entries saved to " idxfile " =  " isin
  347. foo=cvwrite(idxfile,idxlist)
  348. if aa=0 then say " Error: could not write " idxfile
  349.  
  350. exit
  351.  
  352. /*********************************************************/
  353. /* Load srefilter macro libary, if not already loaded */
  354. load_rxl:procedure expose basedir
  355.  
  356. if macroquery('SREF_VERSION')<>"" then return 1
  357.  
  358. tt=strip(basedir,'t','\')||'\SREFPRC1.RXL'
  359. aa=macroload(tt)
  360.  if aa=0 then do
  361.     say " ERROR: Could not load macrospace library: " tt
  362.    exit
  363. end
  364.  
  365. RETURN 1
  366.  
  367.  
  368.  
  369. /***********************/
  370. /* get the hostname (aa.bb.cc) for this machine */
  371. get_hostname: procedure
  372.     do queued(); pull .; end                   /* flush */
  373.     address cmd '@hostname'  '| rxqueue'    
  374.     parse pull hostname                        
  375.     return hostname
  376.  
  377.  
  378.   
  379.  /* ------------------------------------------------------------------ */
  380.  /* function: Check if ANSI is activated                               */
  381.  /*                                                                    */
  382.  /* call:     CheckAnsi                                                */
  383.  /*                                                                    */
  384.  /* where:    -                                                        */
  385.  /*                                                                    */
  386.  /* returns:  1 - ANSI support detected                                */
  387.  /*           0 - no ANSI support available                            */
  388.  /*          -1 - error detecting ansi                                 */
  389.  /*                                                                    */
  390.  /* note:     Tested with the German and the US version of OS/2 3.0    */
  391.  /*                                                                    */
  392.  /*                                                                    */
  393.  CheckAnsi: PROCEDURE
  394.    thisRC = -1
  395.  
  396.    trace off
  397.                          /* install a local error handler              */
  398.    SIGNAL ON ERROR Name InitAnsiEnd
  399.  
  400.    "@ANSI 2>NUL | rxqueue 2>NUL"
  401.  
  402.    thisRC = 0
  403.  
  404.    do while queued() <> 0
  405.      queueLine = lineIN( "QUEUE:" )
  406.      if pos( " on.", queueLine ) <> 0 | ,                       /* USA */
  407.         pos( " (ON).", queueLine ) <> 0 then                    /* GER */
  408.        thisRC = 1
  409.    end /* do while queued() <> 0 */
  410.  
  411.  InitAnsiEnd:
  412.  signal off error
  413.  RETURN thisRC
  414.  
  415. /* -------------------- */
  416. /* get a yes or no , return 1 if yes */
  417. yesno:procedure expose normal reverse bold
  418. parse arg fooa , allopt,altans
  419. if altans<>" " & words(altans)>1 then do
  420.    w1=strip(word(altans,1))
  421.    w2=strip(word(altans,2))
  422.    a1=left(w1,1) ; a2=left(w2,1)
  423.    a1a=substr(w1,2) ; a2a=substr(w2,2)
  424. end
  425. else do
  426.     a1='Y' ; a1a='es'
  427.     a2='N' ; a2a='o'
  428. end  /* Do */
  429. ayn='  '||bold||a1||normal||a1a||'\'||bold||a2||normal||a2a
  430. if allopt=1 then  ayn=ayn||'\'||bold||'A'||normal||'ll'
  431.  
  432. do forever
  433.  foo1=normal||reverse||fooa||normal||ayn
  434.  call charout,  foo1 normal ':'
  435.  pull anans
  436.  if abbrev(anans,a1)=1 then return 1
  437.  if abbrev(anans,a2)=1 then return 0
  438.  if allopt=1 & abbrev(anans,'A')=1 then return 2
  439. end
  440.  
  441.  
  442.  
  443.  
  444. /* ----------------------------------- */
  445. /* match a file with the control access files (ctls.), and extract neededp privs
  446.  If no match, return emtpy string */
  447. fig_access:procedure expose ctls.
  448.  
  449. parse upper arg theurl0
  450.  nnn=lastpos('/',theurl0)
  451.  if nnn=0 then
  452.     theurl='/'
  453.  else
  454.      theurl=left(theurl0,nnn)
  455.  gotit=0
  456.  starat=0 ;  afterstar=0 ;useprivs=' '
  457.  do mm=1 to ctls.0
  458.     aurl=ctls.mm
  459.     ares=sref_wildcard(theurl,aurl||' '||aurl,0)
  460.     parse var ares astat "," aurl2 ;  astat=strip(astat)
  461.     if astat=0 then iterate   /* no match */
  462.     if astat=1 then do
  463.         gotit=mm
  464.         leave
  465.     end
  466.     else  do
  467.        t1=pos('*',aurl)
  468.        t33=length(aurl)-t1
  469.        if t1 >= starat  then do
  470.           if t1 > starat | t33>afterstar then do
  471.              starat=t1 ; afterstar=t33
  472.              gotit=mm 
  473.           end
  474.        end
  475.     end
  476.  end
  477.  if gotit>0  then useprivs=ctls.gotit.!Privs
  478.  return useprivs
  479.  
  480.  
  481. /***********************************************************/
  482. /* check for, and read, the access control file */
  483. get_ctlfile:procedure expose ctls.
  484. parse arg ctlfile,verbose
  485.  
  486. aa=fileread(ctlfile,tmps,,'E')
  487. if aa=0 then return 0
  488.  
  489. /*if verbose>0 then say "  .... using control file: " ctlfile*/
  490.  
  491. inctl=0
  492. do mm=1 to tmps.0
  493.     aline=strip(tmps.mm)
  494.     if aline='' | abbrev(aline,';')=1  then iterate
  495.     parse upper var aline aurl aprivs ',' .
  496.     aurl=translate(aurl,'/','\')
  497.     aurl=strip(aurl,,'/')
  498.     if pos('*',aurl)=0 then aurl=aurl||'/'
  499.     inctl=inctl+1
  500.     ctls.inctl=strip(aurl)
  501.     ctls.inctl.!privs=aprivs
  502. end /* do */
  503. ctls.0=inctl
  504. return inctl
  505.  
  506.  
  507.  
  508. /***************/
  509. @ get list of exclusions. Use own directory version if available,
  510. or bbs_param_dir if not (they are NOT cumulative)*/
  511. get_exclusion:procedure expose bbsdir exclusion_file
  512. parse arg gets,verbose
  513. arf=strip(gets||'\'||exclusion_file)
  514. t1=stream(arf,'c','query exists')
  515. if t1=' ' then
  516.     t1=stream(bbsdir||exclusion_file,'c','query exists')
  517.  
  518. if t1=' ' then
  519.    return ' '
  520. oo=linein(t1,1,0)
  521. exlist=""
  522. if verbose=1 then say "    ... Using exclusion list: " t1
  523. /* else, read the list */
  524. do while lines(t1)=1
  525.    oo=strip(linein(t1))
  526.    if abbrev(oo,';')=1 then iterate
  527.    exlist=exlist||' '||oo
  528. end /* do */
  529. tt=translate(exlist,' ',','||'1a090a0d'x)
  530. return tt
  531.  
  532.  
  533.  
  534. /*****************************//
  535. /* get file descriptions from .dsc files (does NOT do auto descriptions) */
  536. make_dsc_descriptions:procedure expose continuation_flag default_description ,
  537.          NOTES. bbsdir description_file arglist. notesgen. wildnotes.
  538. parse arg gets,verbose
  539. notes1.0=0
  540. notes.0=0
  541. if description_file<>' ' then do
  542.   yuba=strip(gets||'\'||description_file)
  543.   t1=stream(yuba,'c','query exists')
  544.   if t1<>' ' then do
  545.      if verbose>0  then say  "    ... using description file: " t1
  546.      eek=fileread(t1,'notes',,'E')
  547.      ekk=fix_notes(continuation_flag)
  548.   end
  549. end
  550.  
  551. /* copy to a temporary array, and do it again below */
  552. do arf=1 to notes.0
  553.    notes1.arf.dastuff=notes.arf.dastuff
  554.    notes1.arf.daname=translate(notes.arf.daname,'/','\')
  555. end /* do */
  556. notes1.0=notes.0
  557.  
  558. notes.0=0               /* get next set */
  559.  
  560.  
  561. /* get a generic description file? */
  562. if notesgen.!did=0 & description_file<>' ' then do
  563.   yipper=strip(bbsdir||description_File)
  564.   if verbose=1 then say " Storing generic descriptions: " yipper
  565.   t1=stream(yipper,'c','query exists')
  566.   if t1<>' ' then do
  567.      eek=fileread(t1,'notes',,'E')
  568.      ekk=fix_notes(continuation_flag)
  569.   end
  570.   do jk=1 to notes.0
  571.      notesgen.jk.daname=notes.jk.daname
  572.      notesgen.jk.dastuff=translate(notes.jk.dastuff,'/','\')
  573.   end /* do */
  574.   notesgen.0=notes.0
  575.   notesgen.!did=1
  576.   if verbose>0 then say "  .... # of generic descriptions= " notesgen.0
  577. end
  578. /* add this set to notes1 */
  579. if notesgen.0>0 then do
  580.   obie=notes1.0
  581.   do mm=1 to notesGEN.0
  582.     obie2=obie+mm
  583.     notes1.obie2.daname=translate(notesgen.mm.daname,'/','\')
  584.     notes1.obie2.dastuff=notesgen.mm.dastuff
  585.   end
  586.   notes1.0=obie2
  587. end
  588. drop notes.     /* copy to notes. */
  589. do pp=1 to notes1.0
  590.   notes.pp.daname=notes1.pp.daname
  591.   notes.pp.dastuff=notes1.pp.dastuff
  592.   notes.pp=notes1.pp.daname  /* used for searching */
  593. end /* do */
  594. notes.0=notes1.0
  595. drop notes1.
  596. if default_description<>' ' then do
  597.    ii=notes.0+1
  598.    notes.ii=default_description
  599.    notes.ii.daname='*'
  600.    notes.ii.dastuff=default_description
  601.    notes.0=ii
  602. end  /* Do */
  603.  
  604. /* create the "wildcarded" notes list (used in find_description)*/
  605. nwilds=0
  606. do mm=1 to notes.0
  607.    if pos('*',notes.mm.daname)>0 then do
  608.        nwilds=nwilds+1
  609.        wildnotes.nwilds.daname=notes.mm.daname
  610.        wildnotes.nwilds.dastuff=notes.mm.dastuff
  611.    end  /* Do */
  612. end /* do */
  613. wildnotes.0=nwilds
  614. return 0
  615.  
  616.  
  617.  
  618. return 0
  619.  
  620.  
  621. /**********/
  622. @ fix up notes. info */
  623. fix_notes:procedure expose notes. arglist.
  624. parse arg daflag
  625. if notes.0=0 | arglist.!nodesc=1 then return 0
  626. isnew=1
  627. crlf='0d0a'x
  628.  
  629. stripme=0
  630. if left(daflag,1)=' ' & left(daflag,2)<>' ' then do
  631.    stripme=1
  632.    daflag=strip(daflag)
  633. end
  634. tmps.1=notes.1
  635. tmps.1.!nlines=1
  636. do mm=2 to notes.0
  637.    iscont=0
  638.    if stripme=0 then do   /* not a ' x' continution flag, so must be exact match */
  639.       iscont=abbrev(notes.mm,daflag)
  640.    end
  641.    else do              /* strip spaces from 2..n, then match the "stripped" flag*/
  642.       if left(notes.mm,1)=' ' then   /* if not first space, not a match */
  643.          iscont=abbrev(strip(notes.mm),daflag)
  644.    end
  645.    if iscont=0 then do     /* not a continuation line */
  646.         isnew=isnew+1
  647.         tmps.isnew.!nlines=1
  648.         tmps.isnew=notes.mm
  649.     end
  650.     else do
  651.         milk=pos(daflag,notes.mm)
  652.         tmps.isnew=tmps.isnew||crlf||substr(notes.mm,milk+length(daflag))
  653.         tmps.isnew.!nlines=tmps.isnew.!nlines+1
  654.     end
  655. end
  656. do mm=1 to isnew        /* pull out filename and it's comment */
  657.     parse var tmps.mm  notes.mm.DANAME  notes.mm.daSTUFF
  658.     notes.mm.DANAME=upper(notes.mm.daname)
  659.     notes.mm.!nlines=tmps.mm.!nlines
  660. end
  661.  
  662.  
  663. notes.0=isnew
  664.  
  665. return 0
  666.  
  667.  
  668. /*****************/
  669. /* if aname (or wildcard match) is in exnames, then return 1 */
  670. is_excluded:procedure
  671. parse upper arg aname, exnames
  672. if exnames=' ' then return 0
  673.  
  674. aname=translate(aname,'\','/')
  675. /* check exacts */
  676.   if  wordpos(aname,exnames)>0 then return 1
  677. /* check for wildcards */
  678. if pos('*',exnames)=0 then return 0
  679.  
  680. /* got some, check them */
  681. do mm=1 to words(exnames)
  682.    bword=word(exnames,mm)
  683.    if pos('*',bword)=0 then iterate
  684.    ares=sref_wildcard(aname,bword||' '||bword,0)
  685.    parse var ares astat "," . ; astat=strip(astat)
  686.    if astat<>0 then  return 1
  687. end
  688. return 0
  689.  
  690.  
  691.  
  692.  
  693. /******************/
  694. /* find a description --  .dsc files */
  695. find_description:procedure expose notes. wildnotes. 
  696.  
  697. parse arg chkme
  698.  
  699. if notes.0=0 then return ' '
  700. tt=arraysearch(notes.,yikes,chkme,'X')
  701. if tt>0 then do
  702.        poop=yikes.1
  703.        return notes.poop.dastuff
  704.  end  /* Do */
  705.  
  706. /* else, try wildcard match */
  707.  do ini=1 to wildnotes.0
  708.        oo=sref_wildcard(chkme,wildnotes.ini.daname,0)
  709.        parse var oo stat ',' . ; stat=strip(stat)
  710.        if stat<>0 then return wildnotes.ini.dastuff
  711.  end
  712.  
  713.  return ' '
  714.  
  715.  
  716.  
  717.