Welp, dunno what I did wrong but fixed it with a call to memmove instead
Code:
SHARED_EXP dint cramTextc( void *ud, STRING *B, uint b4, uint not0 )
{
uint p = B->count;
uint i = (b4 < p) ? b4 : p - !!p;
dint err = growTextc( ud, B, not0 );
if ( err )
{
SHARED_ECHO_ERRNO( stdout, err );
return err;
}
if ( not0 )
{
uint k = i + not0;
uint n = p - i;
dint f = 0;
uchar *txt = B->array;
uchar *dst = txt + (B->Vsize * i);
uchar *end = txt + (B->Vsize * k);
for ( p = 0; p < sizeof(dint); ++p )
f = (f << CHAR_BIT) | 032;
memmove( end, dst, B->Vsize * n );
memset( dst, f, B->Vsize * not0 );
}
return 0;
}
SHARED_EXP dint cramTextn( void *ud, STRING *B, uint b4, ptr str, uint not0 )
{
uint p = B->count;
uint i = (b4 < p) ? b4 : p - !!p;
dint err = growTextc( ud, B, not0 );
if ( err )
{
SHARED_ECHO_ERRNO( stdout, err );
return err;
}
if ( not0 )
{
uint k = i + not0;
uint n = p - i;
uchar *txt = B->array;
uchar *dst = txt + (B->Vsize * i);
uchar *end = txt + (B->Vsize * k);
memmove( end, dst, B->Vsize * n );
memcpy( dst, str, B->Vsize * not0 );
}
return 0;
}