char *strrev(char *str){
    char c, *front, *back;

    front = str;
    for(back=str+strlen(str)-1;front < back;front++){
        c=*front;*front=*back;*back=c;
        back--;
    }
    return str;
}

char *itoa(short v, char *buff, short radix_base){
    char *table;
    char *p;
    short n;
    p=buff;
    table = "0123456789abcdefghijklmnopqrstuvwxyz";
    if(v < 0 && radix_base == 10)
       n = -v;
    else 
       n = v;
    while(n>=radix_base){
        *p++=table[n%radix_base];
        n=n/radix_base;
    }
    *p++=table[n];
    if(v < 0 && radix_base == 10) *p++='-';
    *p='\0';
    return strrev(buff);
}

short
print_short(number)
short number;
{
   short number_array[5];
   char buffer[100];
   char char_array[10];
   short index;
   short n;
   short ret;
   short value;

   ret = 0;
   index = 0;

   char_array[0] = '0';
   char_array[1] = '1';
   char_array[2] = '2';
   char_array[3] = '3';
   char_array[4] = '4';
   char_array[5] = '5';
   char_array[6] = '6';
   char_array[7] = '7';
   char_array[8] = '8';
   char_array[9] = '9';

   number_array[4] = 10000;
   number_array[3] = 1000;
   number_array[2] = 100;
   number_array[1] = 10;
   number_array[0] = 1;

   while(index < 5) {
      for(value = 1; value < 10; value++) {
         n = (number - (number - (value * number_array[index])));
         n = n / number_array[index];
         if(n == value) 
            break;
      }
      if(n >= 10)
         break;
      putc(char_array[n]);
      index++;
   }

   return ret;
}
