global int uitostr(char *p, int i) {
/* convert unsigned integer i to ascii */
  pragma unsigned  /* 16 bit unsigned integers */

  int x, flag
  char c
  char *s

  s = p
  *p = '0'
  if (i == 0) {
    *(p+1) = 0
    return (s)
  }
  flag = 0
  /* leading zeros gone yet? */
  x = 10000
  repeat {
    c = '0'
    while (i => x) {
      c = c + 1
      i = i - x
    }
    if (flag == 0 & c != '0') {
      flag = 1
    }
    if (flag == 1) {
      *p = c
      p = p + 1
    }
    x = x / 10
  } until (x == 0)
  *p = 0
  return (s)
}
