3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* Integer to String translator
7 -> base is a value from [-16,-2] V [2,16]
8 -> base < 0: see 'val' as unsigned value
9 -> no checks for buffer overflow and illegal parameters
20 static char numbuf
[MAXWIDTH
];
21 static char vec
[] = "0123456789ABCDEF";
22 register char *p
= &numbuf
[MAXWIDTH
];
23 int sign
= (base
> 0);
25 *--p
= '\0'; /* null-terminate string */
38 if (base
< 0) { /* unsigned */
40 if (val
< 0L) { /* taken from Amoeba src */
44 for (i
= 0; i
< 8 * sizeof val
; i
++) {
58 *--p
= vec
[(int) (val
% base
)];
62 *--p
= '-'; /* don't forget it !! */
65 *--p
= '0'; /* just a simple 0 */