kernels/linux-2.4.0/drivers/isdn/eicon/kprintf.c
/*
 * convert a buffer to ASCII HEX
 */
convert a buffer to ASCII HEX
convert a buffer to ASCII HEX
static
void    do_buffer(  char    *buffer,
                    int     length,
                    char    *s)
{
    static
    char    hex_char [] = "0123456789abcdef";
    char    *b = buffer;
    int     hex_byte;
    int     nybble;
    length = (length >= ((MAX_BUFF / 3) + 1)) ? (MAX_BUFF / 3) : length;
    while (length)
    {
        hex_byte = (int) *b++;
        nybble = (hex_byte >> 4) & 0xf;
        *s++ = hex_char[nybble];
        nybble = hex_byte & 0xf;
        *s++ = hex_char[nybble];
        *s++ = ' ';
        length--;
    }
    *s = '\0';
    return;
}
static void do_buffer ( char * buffer , int length , char * s ) { static char hex_char [ ] = " " ; char * b = buffer ; int hex_byte ; int nybble ; length = ( length >= ( ( MAX_BUFF / 3 ) + 1 ) ) ? ( MAX_BUFF / 3 ) : length ; while ( length ) { hex_byte = ( int ) * b ++ ; nybble = ( hex_byte >> 4 ) & 0xf ; * s ++ = hex_char [ nybble ] ; nybble = hex_byte & 0xf ; * s ++ = hex_char [ nybble ] ; * s ++ = ' ' ; length -- ; } * s = ' \0 ' ; return ; }
convert a buffer to ASCII HEX
convert a buffer to ASCII HEX