18Fermer20
deleted2Le 08/05/2009 à 15:44
I get a problem with pedrom::tmpnam

Test case :
	.xdef	_ti92plus
	.xdef	_main
	.xdef	_flag_2			|don't redraw screen
	.include	"pedrom-asm.h"
	.include	"kernel.h"

_main:
	lea.l	FileName(%pc),%a0
	jsr	pedrom__tmpnam
	pea.l	FileName(%pc)
	jsr	pedrom__printf
	addq.l	#4,%sp
	rts

FileName:	.asciz	"         " |9 spaces

I get that :
:>tmp
temp   0:>

Spaces are whites spaces (0x20). It's not really a PedroM problem, beacause there is no bug with the version that can be dwnloaded on the T3 site. But I use a patched and recompiled version of PedroM. I didn't modify Files.c (which contains pedrom::tmpnam), but I got some problems with A68k, because I use a 64 bits distribution.

How to modify tmpnam to get a correct behavior after having recompiled ?
char *tmpnam(char *s asm("a0"))
{
	if (!s)
		s = TMPNAME, *s++ = 0;
	do {
		/* Don't check if we do a loop, since Ti can't have 65536 files */
		sprintf(s, "temp%04x", TMPNAME_COUNT++);
	} while (SymFindPtr(s+9,0));
	return s;
}