2 * convert unsigned long to text
3 * Copyright (C) 2000 Henry Spencer.
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 * License for more details.
15 * RCSID $Id: ultot.c,v 1.1 2000/08/16 23:07:16 henry Exp $
21 - ultot - convert unsigned long to text
23 size_t /* length required for full conversion */
24 ultot(n, base, dst, dstlen)
27 char *dst; /* need not be valid if dstlen is 0 */
30 char buf[3*sizeof(unsigned long) + 1];
31 char *bufend = buf + sizeof(buf);
34 static char hex[] = "0123456789abcdef";
55 while (bufend - p < HEX32 + 1)
79 *(p + dstlen - 1) = '\0';