[Mauiusers] maui showq - RESOLVED

Åke Sandgren ake.sandgren at hpc2n.umu.se
Mon Nov 20 23:45:40 MST 2006

On Mon, 2006-11-20 at 13:54 -0500, Earle Nietzel wrote:
> The last thing i tried was to remove some compiler options and then
> everything began to work correctly!
> I don't know which option was causing sprintf to act weird but here were
> the options I removed:

Actually the sprintf's wheren't acting weird, they where acting
according to the specification, which in this case is undefined.
sprintf(a, "%s%s...", a, b) is undefined. I.e. whether "a" is first
overwritten or first accessed is up to the compiler.

The correct way to do sprintf's of that kind is
sprintf(a[strlen(a)], "%s...", b)

But, the best way in maui's case would be to rewrite all sprintfs to use
the internal MUSNPrintF.
Unfortunately that is a BIG job since one has to backtrack all "a"'s
back to the top and start from there and work the whole call-tree down

Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
Internet: ake at hpc2n.umu.se   Phone: +46 90 7866134 Fax: +46 90 7866126
Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se

More information about the mauiusers mailing list