[Coco] Fwd: MW-C Cross compiler bug - Solved

Gene Heskett gheskett at wdtv.com
Sun Mar 9 16:58:01 EDT 2014


On Sunday 09 March 2014 16:35:21 Jamie Cho did opine:

> I tracked the error down to the space() function in cprep19. Basically,
> it is no longer legal for strcpy() or memcpy() to be sent overlapping
> arrays, but it is ok with memmove().
> 
And its an error, just waiting to bite somebody.

> The corrected version looks like:
> int
> space (                         /* shrink spaces to one */
>         int a, int b)
> {
>   register char *cptr;
>   char *bptr;
>   size_t line_size;
> 
>   bptr = cptr = &line[b];
> 
>   while (*(++cptr) == ' ');
> 
>   if (bptr != cptr - 1)
>   {
>       line_size = strlen(cptr);
>       memmove(bptr + 1, cptr, line_size);
>       a -= (cptr - bptr - 1);
>   }
> 
>   return a;
> }
> 
> Who is the maintainer of the compiler and where should updates be
> posted?
> 
> Best,
> Jamie

I believe Willard Goosey did the last version of it, cprep19b I believe.

That is definitely not a problem that I know about in the cprep19 I did 
long ago.  OTOH I don't believe I ever fed it any *nix EOL's either except 
by accident.  ISTR I did blow it up once after I had moved to the amiga, 
which used the *nix EOL convention.

And that cprep19 was subsequently used to build the rzsz we have all used 
from version 3.17 to 3.36, over a period of several years and every version 
of "pf" I ever published.  But unless you are using an old DWP on your 
coco, that one can be left buried in the sands of time.   Oh, it also built 
the 2 versions of BRU I published after Mike Sweet's prof bought it and he 
went on to do "cups" a few years later.

I don't think this is the correct way to handle that, and I would be asking 
to check and see how it handles the linux linefeed ($0A) to os9 carriage 
return ($0D) as EOL indicators conversions.  Or heaven forbid, the file was 
once edited on a windows box so it now has both!  The best cure for that is 
a pair of 40 year old *nix utils called d2u and u2d. Shorthand for 
Dos2Unix, and Unix2Dos.

> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco


Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>




More information about the Coco mailing list