1: # include <sccs.h> 2: 3: SCCSID(@(#)itoa.c 8.1 12/31/84) 4: 5: /* 6: ** ITOA -- integer to ascii conversion 7: */ 8: 9: itoa(i, a) 10: register int i; 11: register char *a; 12: { 13: register char *j; 14: char b[6]; 15: 16: if (i < 0) 17: { 18: *a++ = '-'; 19: i = -i; 20: } 21: j = &b[5]; 22: *j-- = 0; 23: do 24: { 25: *j-- = i % 10 + '0'; 26: i /= 10; 27: } while (i); 28: do 29: { 30: *a++ = *++j; 31: } while (*j); 32: return (0); 33: }