Program Spad;
{$NOWALKBACK}
{$NOMAIN}
{ 
  File: [22,310]SPAD.PAS
  Author: Phil Hannay

  Last Edit:  23-JUN-1988 22:28:43 

  History: 
	 23-JUN-1988 21:59:03  - JMB PA3UTL upgrade.
	  9-Aug-84 MRC  taken from comd.pas
}
{[A+,B+,L-,K+,R+] Pasmat Directive }

Procedure Spad (var s:      packed array [lo..hi:integer] of char;
                    chzap: char;
                    chpad: char    );external;

{*USER*
  Procedure will take a string and replace trailing "chzap" chars
  with "chpad" chars.  Works on type0 strings starting at end of
  string, and type1 strings starting at "hi", both working backwards
  until a non-"chzap" character hit. 
}
 
Procedure Spad;

Var
  i, base, top, izap: integer;

Begin
izap:= ord(chzap);
if lo = 0
  then begin
    top:=ord(s[0]);
    base:=1;
    end
  else begin
    top:= hi;
    base:= lo;
    end;
  i:=top+1;
    repeat
      i:= i-1;
      if ord(s[i]) = izap then s[i]:= chpad else i:= base;
    until i=base;
end; {procedure Spad}
