The str_rtrim function from strio.c source elegantly fails (this isn't the Zorro, but the newest version of the 3DGS suite). Everything works well with one exception.
When the input string length is 2 and the last character is a space, the function leaves untouched the input string.

I have more than one ideas how should fix it. If I may propose one, here is the first of them.

Code
STRING* str_rtrim(STRING* input)
{
	int pos;
        BOOL was_a_space = false;
	char* c = _chr(input);
	for (pos = str_len(input) - 1; pos > 0; pos--) {
		if(c[pos]!=32) {
			str_trunc(input,str_len(input)-pos-1);
            was_a_space = false;
			break;
		} else {
            was_a_space = true;
        }
	}
        if(was_a_space == true)
            str_trunc(input,1);
        return input;
}


Maybe the correct place would be the Bug Hunt, I am sorry.
Best regards and Happy New Year
a faithful user of this engine

Last edited by Aku_Aku; 01/11/24 09:51. Reason: correct place