diff options
author | Thomas Schwinge <thomas@schwinge.name> | 2010-12-29 12:00:30 +0100 |
---|---|---|
committer | Ali Polatel <alip@exherbo.org> | 2011-11-05 01:12:35 +0200 |
commit | 38b245b46a51be82a5a5f798255cbbbbc0186f78 (patch) | |
tree | d4210e76396f3d45614f329f8288e10762fad407 /contrib/notmuch-deliver/numlib/strsize.c | |
parent | 5f53ce3e2b9704f4f2a4be92c91f82c697c15b9d (diff) |
Move files copied from maildrop to a separate hierarchy.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
Diffstat (limited to 'contrib/notmuch-deliver/numlib/strsize.c')
-rw-r--r-- | contrib/notmuch-deliver/numlib/strsize.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/contrib/notmuch-deliver/numlib/strsize.c b/contrib/notmuch-deliver/numlib/strsize.c deleted file mode 100644 index 0a7dcaa8..00000000 --- a/contrib/notmuch-deliver/numlib/strsize.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -** Copyright 2001 Double Precision, Inc. -** See COPYING for distribution information. -*/ - -#if HAVE_CONFIG_H -#include "config.h" -#endif -#include "numlib.h" -#include <string.h> - -static const char rcsid[]="$Id: strsize.c,v 1.2 2003/01/05 04:01:17 mrsam Exp $"; - -static void cat_n(char *buf, unsigned long n) -{ -char bb[NUMBUFSIZE+1]; -char *p=bb+sizeof(bb)-1; - - *p=0; - do - { - *--p = "0123456789"[n % 10]; - n=n/10; - } while (n); - strcat(buf, p); -} - -char *libmail_str_sizekb(unsigned long n, char *sizebuf) -{ - /* If size is less than 1K bytes, display it as 0.xK */ - - if (n < 1024) - { - strcpy(sizebuf, "0."); - cat_n(sizebuf, (int)(10 * n / 1024 )); - strcat(sizebuf, "K"); - } - /* If size is less than 1 meg, display is as xK */ - - else if (n < 1024 * 1024) - { - *sizebuf=0; - cat_n(sizebuf, (unsigned long)(n+512)/1024); - strcat(sizebuf, "K"); - } - - /* Otherwise, display in megabytes */ - - else - { - unsigned long nm=(double)n / (1024.0 * 1024.0) * 10; - - *sizebuf=0; - cat_n( sizebuf, nm / 10); - strcat(sizebuf, "."); - cat_n( sizebuf, nm % 10); - strcat(sizebuf, "M"); - } - - return (sizebuf); -} - |