[comp.os.vms] Missing function OTOA in UIC.C dd 1-jul-1988

STAM@HROEUR51.BITNET (AC Stam EUR/ERC) (07/04/88)

/* Function OTOA in UIC.C was not declared; here it is: */


otoa(n,s)       /* convert n to characters in s */
char s[];
int n;
{
 int i, sign;

 if ((sign = n) < 0)    /* record sign */
    n = -n;             /* make n positive */
 i = 0;
 do                     /* generate digits in reverse order */
   {
    s[i++] = n % 8 + '0';       /* get next digit */
   }
 while ((n /= 8) > 0);          /* delete it */
 if (sign < 0)
    s[i++] = '-';
 s[i] = '\0';
 otoa_reverse(s);
}

otoa_reverse(s)         /* reverse string s in place */
char s[];
{
 int c,i,j;

 for (i = 0, j = strlen(s)-1; i < j; i++, j--)
     {
      c = s[i];
      s[i] = s[j];
      s[j] = c;
     }
}