Issue information

Issue ID
#372
Status
Fixed
Severity
Medium
Started
Hercules Elf Bot
Nov 5, 2007 9:52
Last Post
Hercules Elf Bot
Nov 5, 2007 9:52
Confirmation
N/A

Hercules Elf Bot - Nov 5, 2007 9:52

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=372

The function 'snprintf' is not good enough on neither bsd nor windows. I really suggest making a wrapper that has well-defined properties...
- params <buffer, count, format, args>
- the string shall always be terminated at buffer[count-1]
- the return value shall be the number of chars printed (with / without the zero at the end is yet to be decided)

Current windows glitches:
- does not terminate buffer if length >= count
- returns -1 if length > count
- returns length (w/o zero) if length <= count

Current freebsd glitches:
- returns the length of the original string, even though less chars were printed (due to 'count' limitation)