procedure fake_cat_pass(anyvar f         : fib;
			      unum      : unitnum);
type
  catarray      = array[0..maxint] of passentry;
  catarrayptr   = ^catarray;
var
  volpass       : name_type;
  fns           : file_name_set;
  done          : boolean;
  i             : integer;
  j             : integer;
  catindx       : integer;
  catentryindx  : integer;
  tempcapbits   : record case boolean of
		    true  : (i  : integer);
		    false : (b  : access_capabilities);
		  end;
begin
  catentryindx  := 0;
  done  := false;
  with f, packet_ptr.rcatpass^ do
    begin
      setup_fns(f, fns);
      if ioresult = ord(inoerror) then
	begin
	  strtopaoc16(fvid,volpass);
	  foptstring    := anyptr(passwordarrayptr);
	  catindx   := fpos + 1;
	  while (catentryindx < fpeof) and (not done) and (ioresult = ord(inoerror)) do
	    begin
	      catpasspack(unum,1,addr(fns),start_alternate,
			  pathid,volpass,24,catindx);
	      if ioresult = ord(inoerror) then
		begin
		  i   := 1;
		  if actual_num_passwords < 24 then
		    done      := true;
		  while i <= actual_num_passwords do
		    if catentryindx < fpeof then
		      begin
			with password_info[i], catarrayptr(fwindow)^[catentryindx] do
			  begin
			    paoc16tostr(password,pword);
			    tempcapbits.b   := capabilities;
			    pbits           := tempcapbits.i;
			  end;
			i             := i + 1;
			catentryindx  := catentryindx + 1;
		      end
		    else
		      begin
			i       := 25;
			done    := true;
		      end;
		  catindx     := catindx + 24;
		end;
	    end;
	end;
      fpeof := catentryindx;
    end;
end;
