mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* miscutil.c (hextobyte): Moved here from g10/misc.c so I can use it in
the keyserver helpers.
This commit is contained in:
parent
93b5a811ef
commit
fcc02ac22a
@ -1,3 +1,8 @@
|
||||
2004-02-21 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* miscutil.c (hextobyte): Moved here from g10/misc.c so I can use
|
||||
it in the keyserver helpers.
|
||||
|
||||
2004-02-20 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* mkdtemp.c: New (moved from g10/), setenv.c: New, unsetenv.c:
|
||||
|
@ -430,3 +430,28 @@ match_multistr(const char *multistr,const char *match)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user