[comp.os.minix] mutli-column problem & fix for "pr".

bww@hpqtdla.HP.COM (Brian Woodroffe) (03/27/89)

I have experienced problems with the ST-issue of `pr', in that when I
asked for multi-column output (eg `pr -5') the program would bomb out
with a Signal=11 trap.  I guess the problem might also be present in
the PC-version.

I have traced the problem down to the following:-
the initial call to malloc for pointer storage for pointers to the
character strings which are the rows and columns entries is not NULLed.
Hence when in procedure `format', the character strings pointed to are
released, random areas of memory are released.

Solution  (I do not have patch, and as yet I do not have electronic
information interchange capability between the net and my ST)
1/ at around line 160, at the block start add two shorts i,j
2/ at around line 171, after the call to `myalloc' add the following
statement:-
   for (i = 0; i < length; i++)
      for (j = 0; j < columns; j++)
         LBUF(i,j) = (char *) NIL_PTR;

Brian Woodroffe.
bww%hpqtdla@hplabs.HP.COM

Hewlett-Packard,
South Queensferry Telecomms Division
South Queensferry,
West Lothian; EH30-9TG
Scotland
(+44)- 31-331-1000