Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
86c4ae8d
...
86c4ae8dc8d2e25b100a835d9a53a280f96889f9
authored
2006-03-12 14:15:48 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use mu_strftime
1 parent
e3fc8d4b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
49 deletions
imap4d/append.c
imap4d/fetch.c
libproto/imap/mbox.c
libproto/mbox/mbox.c
libsieve/actions.c
mailbox/message.c
mailbox/message_stream.c
mh/mh_init.c
mh/send.c
imap4d/append.c
View file @
86c4ae8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2005
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -67,7 +67,7 @@ _append_date (mu_envelope_t envelope, char *buf, size_t len, size_t *pnwrite)
mu_message_t
msg
=
mu_envelope_get_owner
(
envelope
);
struct
tm
**
tm
=
mu_message_get_owner
(
msg
);
strftime
(
buf
,
len
,
"%a %b %d %H:%M:%S %Y"
,
*
tm
);
mu_
strftime
(
buf
,
len
,
"%a %b %d %H:%M:%S %Y"
,
*
tm
);
return
0
;
}
...
...
imap4d/fetch.c
View file @
86c4ae8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2005
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -367,7 +367,7 @@ fetch_internaldate (struct fetch_command *command, char **arg ARG_UNUSED)
time_t
t
=
time
(
NULL
);
tmp
=
localtime
(
&
t
);
}
strftime
(
date
,
sizeof
(
date
),
"%d-%b-%Y %H:%M:%S"
,
tmp
);
mu_
strftime
(
date
,
sizeof
(
date
),
"%d-%b-%Y %H:%M:%S"
,
tmp
);
util_send
(
"%s"
,
command
->
name
);
util_send
(
"
\"
%s +0000
\"
"
,
date
);
return
RESP_OK
;
...
...
libproto/imap/mbox.c
View file @
86c4ae8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003, 2004,
2005 Free Software Foundation, Inc.
2005
, 2006
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -1560,31 +1560,20 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen,
parsed, use the calendar time. */
if
(
now
==
(
time_t
)
-
1
)
{
struct
tm
*
gmt
;
struct
tm
*
gmt
;
time
(
&
now
);
gmt
=
gmtime
(
&
now
);
time
(
&
now
);
gmt
=
gmtime
(
&
now
);
tm
=
*
gmt
;
}
{
int
len
=
strftime
(
buffer
,
buflen
,
" %a %b %d %H:%M:%S %Y"
,
&
tm
);
/* FIXME: I don't know what strftime does if the buflen is too
short, or it fails. Assuming that it won't fail, this is my guess
as to the right thing.
I think if the buffer is too short, it will fill it as much
as it can, and nul terminate it. But I'll terminate it anyhow.
*/
if
(
len
==
0
)
{
len
=
buflen
-
1
;
buffer
[
len
]
=
0
;
}
if
(
plen
)
*
plen
=
len
;
char
tmpbuf
[
MU_ENVELOPE_DATE_LENGTH
+
1
];
size_t
n
=
mu_strftime
(
tmpbuf
,
sizeof
tmpbuf
,
MU_ENVELOPE_DATE_FORMAT
,
localtime
(
&
tm
));
n
=
mu_cpystr
(
buffer
,
tmpbuf
,
buflen
);
if
(
plen
)
*
plen
=
n
;
}
return
0
;
}
...
...
libproto/mbox/mbox.c
View file @
86c4ae8
...
...
@@ -1373,12 +1373,11 @@ restore_date (mu_message_t msg, mbox_data_t mud)
if
(
date
&&
mu_parse_date
(
date
,
&
t
,
NULL
))
{
char
datebuf
[
25
];
char
datebuf
[
MU_ENVELOPE_DATE_LENGTH
+
1
];
/* FIXME: 1. Preserve TZ info */
/* FIXME: 2. Do not depend on LC */
strftime
(
datebuf
,
sizeof
datebuf
,
"%a %b %d %H:%M:%S %Y"
,
localtime
(
&
t
));
mu_strftime
(
datebuf
,
sizeof
datebuf
,
MU_ENVELOPE_DATE_FORMAT
,
localtime
(
&
t
));
free
(
date
);
date
=
strdup
(
datebuf
);
}
...
...
libsieve/actions.c
View file @
86c4ae8
...
...
@@ -155,7 +155,7 @@ mime_create_reason (mu_mime_t mime, mu_message_t msg, const char *text)
time
(
&
t
);
tm
=
localtime
(
&
t
);
strftime
(
datestr
,
sizeof
datestr
,
"%a, %b %d %H:%M:%S %Y %Z"
,
tm
);
mu_
strftime
(
datestr
,
sizeof
datestr
,
"%a, %b %d %H:%M:%S %Y %Z"
,
tm
);
mu_sieve_get_message_sender
(
msg
,
&
sender
);
...
...
mailbox/message.c
View file @
86c4ae8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2004,
2005 Free Software Foundation, Inc.
2005
, 2006
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -948,20 +948,18 @@ message_date (mu_envelope_t envelope, char *buf, size_t len, size_t *pnwrite)
/* FIXME: extract the time from "Date:". */
/* Catch all. */
/* FIXME: ctime() is not thread safe use strftime(). */
t
=
time
(
NULL
);
n
=
strlen
(
ctime
(
&
t
));
if
(
buf
==
NULL
||
len
==
0
)
{
if
(
pnwrite
)
*
pnwrite
=
n
;
return
0
;
n
=
MU_ENVELOPE_DATE_LENGTH
;
}
else
{
char
tmpbuf
[
MU_ENVELOPE_DATE_LENGTH
+
1
];
t
=
time
(
NULL
);
n
=
mu_strftime
(
tmpbuf
,
sizeof
tmpbuf
,
MU_ENVELOPE_DATE_FORMAT
,
localtime
(
&
t
));
n
=
mu_cpystr
(
buf
,
tmpbuf
,
len
);
}
n
=
(
n
>
len
)
?
len
:
n
;
strncpy
(
buf
,
ctime
(
&
t
),
n
);
buf
[
n
]
=
'\0'
;
if
(
pnwrite
)
*
pnwrite
=
n
;
return
0
;
...
...
mailbox/message_stream.c
View file @
86c4ae8
...
...
@@ -261,11 +261,11 @@ restore_envelope (mu_stream_t str, struct _mu_rfc822_message **pmenv)
{
struct
tm
*
tm
;
time_t
t
;
char
date
[
80
];
char
date
[
80
];
/* FIXME: This size is way too big */
time
(
&
t
);
tm
=
gmtime
(
&
t
);
strftime
(
date
,
sizeof
(
date
),
"%a %b %e %H:%M:%S %Y"
,
tm
);
mu_
strftime
(
date
,
sizeof
(
date
),
"%a %b %e %H:%M:%S %Y"
,
tm
);
env_date
=
strdup
(
date
);
}
...
...
mh/mh_init.c
View file @
86c4ae8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003,
2005 Free Software Foundation, Inc.
2005
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -357,7 +357,7 @@ mh_audit_open (char *name, mu_mailbox_t mbox)
time
(
&
t
);
tm
=
localtime
(
&
t
);
strftime
(
date
,
sizeof
date
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_
strftime
(
date
,
sizeof
date
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_mailbox_get_url
(
mbox
,
&
url
);
fprintf
(
fp
,
"<<%s>> %s %s
\n
"
,
...
...
@@ -758,7 +758,7 @@ mh_annotate (mu_message_t msg, char *field, char *text, int date)
char
datebuf
[
80
];
t
=
time
(
NULL
);
tm
=
localtime
(
&
t
);
strftime
(
datebuf
,
sizeof
datebuf
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_
strftime
(
datebuf
,
sizeof
datebuf
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_header_set_value
(
hdr
,
field
,
datebuf
,
0
);
}
...
...
@@ -786,7 +786,7 @@ mh_create_message_id (int subpart)
char
*
host
;
char
*
p
;
strftime
(
date
,
sizeof
date
,
"%Y%m%d%H%M%S"
,
tm
);
mu_
strftime
(
date
,
sizeof
date
,
"%Y%m%d%H%M%S"
,
tm
);
mu_get_host_name
(
&
host
);
if
(
subpart
)
...
...
mh/send.c
View file @
86c4ae8
...
...
@@ -456,7 +456,7 @@ _action_send (void *item, void *data)
time_t
t
=
time
(
NULL
);
struct
tm
*
tm
=
localtime
(
&
t
);
strftime
(
date
,
sizeof
date
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_
strftime
(
date
,
sizeof
date
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mu_header_set_value
(
hdr
,
MU_HEADER_DATE
,
date
,
1
);
if
(
mu_header_get_value
(
hdr
,
MU_HEADER_FROM
,
NULL
,
0
,
&
n
))
...
...
Please
register
or
sign in
to post a comment