From: Timo Sirainen Date: Sat, 20 Feb 2010 07:24:48 +0000 (+0200) Subject: doveadm: Removed duplication of unixdate2str(). X-Git-Tag: 2.0.beta3~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=068357123aba2906c17a4e3bbe57417570be1958;p=thirdparty%2Fdovecot%2Fcore.git doveadm: Removed duplication of unixdate2str(). --HG-- branch : HEAD --- diff --git a/src/doveadm/doveadm-dump-index.c b/src/doveadm/doveadm-dump-index.c index 3f47265b56..25fad3e6e8 100644 --- a/src/doveadm/doveadm-dump-index.c +++ b/src/doveadm/doveadm-dump-index.c @@ -61,16 +61,6 @@ struct dbox_mail_index_map_record { uint32_t size; }; -static const char *unixdate2str(time_t timestamp) -{ - static char buf[64]; - struct tm *tm; - - tm = localtime(×tamp); - strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm); - return buf; -} - static void dump_hdr(struct mail_index *index) { const struct mail_index_header *hdr = &index->map->hdr; diff --git a/src/doveadm/doveadm-dump-mailboxlog.c b/src/doveadm/doveadm-dump-mailboxlog.c index 08c6461ae0..59dcf3038f 100644 --- a/src/doveadm/doveadm-dump-mailboxlog.c +++ b/src/doveadm/doveadm-dump-mailboxlog.c @@ -10,16 +10,6 @@ #include #include -static const char *unixdate2str(time_t timestamp) -{ - static char buf[64]; - struct tm *tm; - - tm = localtime(×tamp); - strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm); - return buf; -} - static int dump_record(int fd) { off_t offset; diff --git a/src/doveadm/doveadm.c b/src/doveadm/doveadm.c index 1db0a132d7..5bac41aa6b 100644 --- a/src/doveadm/doveadm.c +++ b/src/doveadm/doveadm.c @@ -9,6 +9,7 @@ #include #include #include +#include bool doveadm_verbose = FALSE, doveadm_debug = FALSE; @@ -41,6 +42,16 @@ void help(const struct doveadm_cmd *cmd) exit(0); } +const char *unixdate2str(time_t timestamp) +{ + static char buf[64]; + struct tm *tm; + + tm = localtime(×tamp); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm); + return buf; +} + static void cmd_help(int argc ATTR_UNUSED, char *argv[]) { const struct doveadm_cmd *cmd; diff --git a/src/doveadm/doveadm.h b/src/doveadm/doveadm.h index 800d02732b..4ee48f7ccd 100644 --- a/src/doveadm/doveadm.h +++ b/src/doveadm/doveadm.h @@ -25,4 +25,6 @@ void doveadm_register_cmd(const struct doveadm_cmd *cmd); void usage(void); void help(const struct doveadm_cmd *cmd); +const char *unixdate2str(time_t timestamp); + #endif