Commit | Line | Data |
---|---|---|
d9898ee8 | 1 | /* |
b0322a85 | 2 | ** Copyright 1998 - 2010 Double Precision, Inc. |
d9898ee8 | 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 | ||
d9898ee8 | 12 | |
13 | char *libmail_str_off_t(off_t t, char *arg) | |
14 | { | |
15 | char buf[NUMBUFSIZE]; | |
16 | char *p=buf+sizeof(buf)-1; | |
17 | int isneg=0; | |
18 | ||
19 | if (t < 0) | |
20 | { | |
21 | t= -t; | |
22 | isneg=1; | |
23 | } | |
24 | ||
25 | *p=0; | |
26 | do | |
27 | { | |
28 | *--p= '0' + (t % 10); | |
29 | t=t / 10; | |
30 | } while(t); | |
31 | ||
32 | if (isneg) | |
33 | *--p='-'; | |
34 | ||
35 | return (strcpy(arg, p)); | |
36 | } | |
b0322a85 CE |
37 | |
38 | char *libmail_str_int64_t(int64_t t, char *arg) | |
39 | { | |
40 | char buf[NUMBUFSIZE]; | |
41 | char *p=buf+sizeof(buf)-1; | |
42 | int isneg=0; | |
43 | ||
44 | if (t < 0) | |
45 | { | |
46 | t= -t; | |
47 | isneg=1; | |
48 | } | |
49 | ||
50 | *p=0; | |
51 | do | |
52 | { | |
53 | *--p= '0' + (t % 10); | |
54 | t=t / 10; | |
55 | } while(t); | |
56 | ||
57 | if (isneg) | |
58 | *--p='-'; | |
59 | ||
60 | return (strcpy(arg, p)); | |
61 | } | |
62 | ||
63 | ||
64 |