mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-04 20:38:50 +01:00
b17fcc5d51
can contain replacement files that can be linked to keyserver helpers without bringing in the whole libutil.a. libutil.a contains a complete copy of libcompat.a so we only need to link to one of them.
25 lines
471 B
C
25 lines
471 B
C
int
|
|
hextobyte (const char *s)
|
|
{
|
|
int c;
|
|
|
|
if ( *s >= '0' && *s <= '9' )
|
|
c = 16 * (*s - '0');
|
|
else if ( *s >= 'A' && *s <= 'F' )
|
|
c = 16 * (10 + *s - 'A');
|
|
else if ( *s >= 'a' && *s <= 'f' )
|
|
c = 16 * (10 + *s - 'a');
|
|
else
|
|
return -1;
|
|
s++;
|
|
if ( *s >= '0' && *s <= '9' )
|
|
c += *s - '0';
|
|
else if ( *s >= 'A' && *s <= 'F' )
|
|
c += 10 + *s - 'A';
|
|
else if ( *s >= 'a' && *s <= 'f' )
|
|
c += 10 + *s - 'a';
|
|
else
|
|
return -1;
|
|
return c;
|
|
}
|