#ifndef _WRITE_DEC_ULONG_
#define _WRITE_DEC_ULONG_
//-----------------------------------------------------------------------------
// function	write_dec_ulong
// purpose	Format a decimal number from an unsigned long and write it.
// arguments	1 (int) file descriptor
//		2 (unsigned long) value
// returns	whatever write() returns
//-----------------------------------------------------------------------------
static
int
write_dec_ulong (
    int			arg_fd
    ,
    unsigned long	arg_num
    )
{
    char *	ptr	;
    char	buf	[12];

    ptr = buf + 11;
    while ( ptr > buf ) {
	* ptr = '0' + ( arg_num % 10 );
	arg_num /= 10;
	if ( arg_num == 0 ) break;
	-- ptr;
    }
    return write( arg_fd, ptr, buf + 12 - ptr );
}
#endif /* _WRITE_DEC_ULONG_ */

