1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include "ste.h" char * steprl(char *dst, char *end, long n) { if (dst >= end) return end; char buf[24]; char *bufend = buf + sizeof buf; char *s = bufend; int neg = n < 0; if (neg) n = -n; do { *--s = '0' + (n % 10); n /= 10; } while (n > 0); if (neg) *--s = '-'; return stecpe(dst, end, s, bufend); }