(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
[inherit('sys$library:pascal$lib_routines','sys$library:starlet')]
program problem(input,output);

type
   pstr = varying [255] of char;
   word = [word] 0..65535;

function write_direct(buf : pstr) : integer;

var
   stat : integer;
   ch : word;

begin
   stat := $assign(devnam := 'TT', chan := ch);
   if not(odd(stat)) then return stat;
   stat := $qiow(chan := ch, func := IO$_WRITEVBLK, p1 := buf.body, p2 := buf.length);
   if not(odd(stat)) then return stat;
   stat := $dassgn(chan := ch);
   if not(odd(stat)) then return stat;
   return SS$_NORMAL;
end;

var
   i : integer;
   buf : pstr;

begin
   for i := 1 to 10 do begin
      writev(buf, '*');
      write_direct(buf);
      lib$wait(%f_float 1.0);
   end;
   writeln;
end.
