X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=contrib%2Fnotmuch-deliver%2Fmaildrop%2Fnumlib%2Fstrsize.c;fp=contrib%2Fnotmuch-deliver%2Fmaildrop%2Fnumlib%2Fstrsize.c;h=0000000000000000000000000000000000000000;hp=1c903122f6153bf509aa1d1572799deed8386d8c;hb=9060a1f61771a5d4a320e04223a077d1b5c075ea;hpb=5ddaf59915b477d9eccfafaf7e5ac8094ea8f6ca diff --git a/contrib/notmuch-deliver/maildrop/numlib/strsize.c b/contrib/notmuch-deliver/maildrop/numlib/strsize.c deleted file mode 100644 index 1c903122..00000000 --- a/contrib/notmuch-deliver/maildrop/numlib/strsize.c +++ /dev/null @@ -1,61 +0,0 @@ -/* -** Copyright 2001 Double Precision, Inc. -** See COPYING for distribution information. -*/ - -#if HAVE_CONFIG_H -#include "config.h" -#endif -#include "numlib.h" -#include - - -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); -} -