Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
5417446e
...
5417446e257acc8fab46cef5d25605a810690ba4
authored
2001-07-13 03:52:16 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
News funtions: mu_hex2ul(), mu_hexstr2ul().
1 parent
7557c0b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
include/mailutils/mutil.h
mailbox/mutil.c
include/mailutils/mutil.h
View file @
5417446
...
...
@@ -37,6 +37,9 @@
extern
"C"
{
#endif
extern
unsigned
long
mu_hex2ul
__P
((
char
hex
));
extern
size_t
mu_hexstr2ul
__P
((
unsigned
long
*
ul
,
const
char
*
hex
,
size_t
len
));
struct
mu_timezone
{
int
utc_offset
;
...
...
mailbox/mutil.c
View file @
5417446
...
...
@@ -30,6 +30,41 @@
#include <unistd.h>
#include <mailutils/mutil.h>
/* convert a sequence of hex characters into an integer */
unsigned
long
mu_hex2ul
(
char
hex
)
{
if
(
hex
>=
'0'
&&
hex
<=
'9'
)
return
hex
-
'0'
;
if
(
hex
>=
'a'
&&
hex
<=
'z'
)
return
hex
-
'a'
;
if
(
hex
>=
'A'
&&
hex
<=
'Z'
)
return
hex
-
'A'
;
return
-
1
;
}
size_t
mu_hexstr2ul
(
unsigned
long
*
ul
,
const
char
*
hex
,
size_t
len
)
{
size_t
r
;
*
ul
=
0
;
for
(
r
=
0
;
r
<
len
;
r
++
)
{
unsigned
long
v
=
mu_hex2ul
(
hex
[
r
]);
if
(
v
==
-
1
)
return
r
;
*
ul
=
*
ul
*
16
+
v
;
}
return
r
;
}
/* Convert struct tm into time_t, taking into account timezone offset.
mktime() always treats tm as if it was localtime, so convert it
...
...
Please
register
or
sign in
to post a comment