Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / 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 static const char rcsid[]="$Id: strhdevt.c,v 1.2 2003/03/12 02:45:56 mrsam Exp $";
13
14 static const char xdigit[]="0123456789ABCDEF";
15
16 char *libmail_strh_dev_t(dev_t t, char *arg)
17 {
18 char buf[sizeof(t)*2+1];
19 char *p=buf+sizeof(buf)-1;
20 unsigned i;
21
22 *p=0;
23 for (i=0; i<sizeof(t)*2; i++)
24 {
25 *--p= xdigit[t & 15];
26 t=t / 16;
27 }
28 return (strcpy(arg, p));
29 }