]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-deliver/maildrop/numlib/strofft.c
test/python: set LD_LIBRARY_PATH and PYTHONPATH to use local notmuch
[notmuch] / contrib / notmuch-deliver / maildrop / numlib / strofft.c
1 /*
2 ** Copyright 1998 - 2010 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: strofft.c,v 1.6 2010/03/19 01:09:26 mrsam Exp $";
13
14 char *libmail_str_off_t(off_t t, char *arg)
15 {
16         char    buf[NUMBUFSIZE];
17         char    *p=buf+sizeof(buf)-1;
18         int     isneg=0;
19
20         if (t < 0)
21         {
22                 t= -t;
23                 isneg=1;
24         }
25
26         *p=0;
27         do
28         {
29                 *--p= '0' + (t % 10);
30                 t=t / 10;
31         } while(t);
32
33         if (isneg)
34                 *--p='-';
35
36         return (strcpy(arg, p));
37 }
38
39 char *libmail_str_int64_t(int64_t t, char *arg)
40 {
41         char    buf[NUMBUFSIZE];
42         char    *p=buf+sizeof(buf)-1;
43         int     isneg=0;
44
45         if (t < 0)
46         {
47                 t= -t;
48                 isneg=1;
49         }
50
51         *p=0;
52         do
53         {
54                 *--p= '0' + (t % 10);
55                 t=t / 10;
56         } while(t);
57
58         if (isneg)
59                 *--p='-';
60
61         return (strcpy(arg, p));
62 }
63
64
65