Program Strunc;

{ File: [22,310]STRUNC.PAS
  Author: Phil Hannay

  Last Edit:  23-JUN-1988 22:31:56 

  History: 
	 23-JUN-1988 21:59:35  - JMB PA3UTL upgrade.
	  9-Aug-84 MRC  removed from comd.pas
}
{$NOMAIN}
{$NOWALKBACK}
{[A+,B+,L-,K+,R+ Pasmat Directive }


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

{*USER*
  Truncate the specified string "s".  The string may be of a type0
  or type1.  Trailing blanks are replaced by null characters in
  a type1 string, the length parameter is adjusted to the last
  non-blank character character in a type0 string.
}

procedure Strunc;

Var
  top: integer;

Begin
if lo=0
  then begin
    top:= ord(s[0]);
    while (s[top] = ' ') and (top >= 1) do top:= top-1;
    s[0]:= chr(top)
    end
  else begin
    top:= hi;
    while (s[top] = chr(0)) and (top > 1) do top:= top-1;
    while top > 0 do begin
       if s[top] = ' ' 
         then begin
           s[top]:= chr(0);
           top:= top-1;
           end
         else top:= 0;
       end;
    end;
end;  {procedure Strunc}

