|
|
1.1 ! root 1: # include <sccs.h> ! 2: ! 3: SCCSID(@(#)IIitos.c 8.1 12/31/84) ! 4: ! 5: ! 6: /* ! 7: ** INTEGER OUTPUT CONVERSION ! 8: ** ! 9: ** The integer `i' is converted to ascii and put ! 10: ** into the static buffer `buf'. The address of the starting ! 11: ** point in `buf' is ! 12: ** returned. ! 13: ** ! 14: ** Number is converted from least significant forwards. ! 15: */ ! 16: ! 17: char *IIitos(i1) ! 18: int i1; ! 19: { ! 20: register char *a; ! 21: register int i; ! 22: static char buf[25]; ! 23: ! 24: i = i1; ! 25: if (i < 0) ! 26: i = -i; ! 27: ! 28: a = &buf[sizeof buf - 1]; ! 29: *a-- = '\0'; ! 30: do ! 31: { ! 32: *a-- = i % 10 + '0'; ! 33: i /= 10; ! 34: } while (i); ! 35: if (i1 < 0) ! 36: *a-- = '-'; ! 37: ! 38: a++; ! 39: return (a); ! 40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.