/* * b36: routines to manipulate base-36 numbers (0-9a-z) * * a 3-digit base-36 number spans 0-46655, which is a perfectly * good range of seqence #'s for uucp workfiles. (On the Atari ST * and MS-DOS, filename limitations force the sequence #'s to be * 3 digits or less, so decimal & hexidecimal don't have enough * range to assure minimal collisions on a busy system.) */ #include /* * itob36() converts an integer into a 3-digit base-36 string, then returns * a pointer to that string. The string is in static storage, so it * will be overwritten with each successive call to itob36(). */ char * itob36(num) register num; { static char nb[4]; register x, dig; nb[x = 3] = 0; /* work backwards up the string */ do { dig = num%36; num /= 36; nb[--x] = (dig<10) ? (dig+'0') : ((dig-10)+'a'); } while (x > 0); return nb; } /* itob36() */