From: ORAKEL@rzmain.rz.uni-ulm.de (Framstag)
Newsgroups: comp.os.vms
Subject: Re: > Re: WANTED: Extracting utility for VMS_SHARE
Date: 4 Sep 92 20:03:20 GMT
Organization: University of Ulm, Germany
X-News-Reader: VMS NEWS 1.24

In <1992Sep4.092812.3065@cnplss5.cnps.philips.nl> NL0242T@nlzcl.decnet.philips.nl writes:

> > I was wondering if anyone would happen to have a utility that extracts VMS_SHARE
> > files in the correct order.  This would be nice when there are over 30 or so 
> > files to be extracted.  Thanks!!!
> 
> A while ago I wrote a quick dirty program that does something like that.
> I named it UnArc.Com and you can find it below.

Sorry, Oscar, but I find it unhandy. Your program needs n single-files,
mine only one.
In VMS NEWS I just do a SAVE/ALL/UNREAD/SUBJECT=*SHARE* or extract them
with the cursor and function keys into one file and start SHAREFIX.EXE

You can RUN SHAREFIX  or  MCR SYS$DISK:[]SHAREFIX share.tmp fixed.shr


{ Author: Ulli 'Framstag' Horlacher , framstag@rz.uni-ulm.de , Nov 1991 }

[ inherit('sys$library:pascal$lib_routines'),check(all) ]

program  sharefix (input,output);
      
type   str = varying [80] of char;
      
var   zeile                        : array [1..50000] of str;
      parameter,read_from,write_to : str;
      delemiter                    : array [(startl,endl),1..100] of integer;
      inf,outf,err                 : text;
      error                        : boolean := false;
      i,z,n,part,parts,
      lastdelemiter,num,maxl       : integer := 0;

      
begin

  lib$get_foreign(%descr parameter);
  i:=index(parameter,' ');
  if i=0 then begin
    writeln;
    writeln('SHAREFIX restores VMS-SHARE-files with wrong or which do');
    writeln('do include mail or news-headers.');
    writeln('Just save all parts in one single file.');
    writeln;
    write('read from: ');
    readln(read_from);
    write('write to: ');
    readln(write_to);
    end
  else begin
    read_from:=substr(parameter,1,i);
    write_to:=substr(parameter,i,length(parameter)-i+1);
  end;

  open (inf,read_from,history:=old);
  reset(inf);
  repeat
    maxl:=maxl+1;
    readln(inf,zeile[maxl]);
  until eof(inf);
  close (inf);
  
  for n:=1 to maxl do begin
    if zeile[n]='$! ------------------ CUT HERE -----------------------'
    then begin
      delemiter[startl,1]:=n;
      readv(substr(zeile[n+13],33,index(substr(zeile[n+13],33,3),' ')),parts);
    end;
    if zeile[n]='$ EXIT' then lastdelemiter:=n;
    if length(zeile[n])>40 then begin
      if substr(zeile[n],1,30)='-+-+-+-+-+-+-+-+ START OF PART' then begin
        readv(substr(zeile[n],32,index(substr(zeile[n],32,3),' ')),num);
        delemiter[startl,num]:=n;
      end;
      if substr(zeile[n],1,30)='+-+-+-+-+-+-+-+-  END  OF PART' then begin
        readv(substr(zeile[n],32,index(substr(zeile[n],32,3),' ')),num);
        delemiter[endl,num]:=n;
      end
    end
  end;

  delemiter[endl,parts]:=lastdelemiter;

  open(err,'sys$error',history:=new);
  rewrite(err);
  for i:=1 to parts do begin
    if delemiter[startl,i]=0 then begin
      writeln(err,'Error:  missing start of part',i:3);
      error:=true;
    end;
    if delemiter[endl,i]=0 then begin
      writeln(err,'Error:  missing end of part',i:3);
      error:=true;
    end
  end;

  if not(error) then begin
    open (outf,write_to,history:=new);
    rewrite(outf);
    for part:=1 to parts do begin
      for z:=delemiter[startl,part] to delemiter[endl,part]
      do writeln(outf,zeile[z]);
    end;
    close (outf);
    writeln(err,'parts:',parts:3);
    end

end.  


\  Ulli 'Framstag' Horlacher    \    psi%0262450502601::rzmain::orakel  \
 \  Student consultant VAX/VMS and networks   \  orakel@dulruu51.bitnet  \
  \  Rechenzentrum  Universitaet Ulm  Germany  \    orakel@rz.uni-ulm.de  \
   \  "With mainframes you just can do nonsense, with PCs not even that."  \
Newsgroups: comp.os.vms