static  char sccsid[]="@(#) cmitoa.c 1.1 98/09/08 10:18:02";
#include "akacommon.h"

int cmn_i_to_a(n, str)
int  n;
char *str;
{
	int i,sign;

	if( (sign = n) < 0 )
		n = -n;

	i = 0;

	do {
		str[i++] = n % 10 + '0';
	} while( (n /= 10) > 0 );

	if (sign < 0)
		str[i++] = '-';

	str[i] = '\0';

	cmn_reverse(str);
}

int cmn_reverse(str)
char *str;
{
	int c,i,j;

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