]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-deliver/maildrop/numlib/strhdevt.c
9ff45f283302eca2f7296fec1e18056c4b908b59
[notmuch] / contrib / notmuch-deliver / maildrop / numlib / strhdevt.c
1 /*
2 ** Copyright 1998 - 2003 Double Precision, Inc.
3 ** See COPYING for distribution information.
4 */
5
6 #if     HAVE_CONFIG_H
7 #include        "config.h"
8 #endif
9 #include        "numlib.h"
10 #include        <string.h>
11
12
13 static const char xdigit[]="0123456789ABCDEF";
14
15 char *libmail_strh_dev_t(dev_t t, char *arg)
16 {
17 char    buf[sizeof(t)*2+1];
18 char    *p=buf+sizeof(buf)-1;
19 unsigned i;
20
21         *p=0;
22         for (i=0; i<sizeof(t)*2; i++)
23         {
24                 *--p= xdigit[t & 15];
25                 t=t / 16;
26         }
27         return (strcpy(arg, p));
28 }