Logo Search packages:      
Sourcecode: nut version File versions  Download package

static int hex2d ( const unsigned char *  start,
unsigned int  len 
) [static]

Convert N characters from hex to decimal.

Parameters:
startBeginning of string to convert
lenMaximum number of characters to consider (max 32)

len characters of start are copied to a temporary buffer, then passed to strtol() to be converted to decimal.

Returns:
See strtol(3)

Definition at line 487 of file tripplite_usb.c.

{
      unsigned char buf[32];
      buf[31] = '\0';

      strncpy((char *)buf, (char *)start, (len < (sizeof buf) ? len : (sizeof buf - 1)));
      if(len < sizeof(buf)) buf[len] = '\0';
      return strtol((char *)buf, NULL, 16);
}

Generated by  Doxygen 1.6.0   Back to index