fix outputting 0.

This commit is contained in:
Felix von Leitner 2001-04-23 13:42:47 +00:00
parent 4f44f5a482
commit f3ce612e36
1 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,9 @@ unsigned int fmt_8long(char *dest,unsigned long i) {
/* first count the number of bytes needed */
for (len=1, tmp=i; tmp>7; ++len) tmp/=8;
if (dest)
for (tmp=i, dest+=len; tmp; tmp/=8)
for (tmp=i, dest+=len; ; ) {
*--dest = (tmp&7)+'0';
if (!(tmp>>=3)) break;
}
return len;
}