]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-deliver/numlib/strofft.c
d93edcbe1ed0872e1e13c2660df4ce50ec27d275
[notmuch] / contrib / notmuch-deliver / numlib / strofft.c
1 /*
2 ** Copyright 1998 - 2002 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.5 2003/01/05 04:01:17 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 }