Skip to content

Commit 10c9cbe

Browse files
author
jkbzh
committed
Some refactoring and adding Changelog entry to PR #73
1 parent 1aa0169 commit 10c9cbe

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ HYPERMAIL VERSION 2.4.1:
1212
-ltrio, where -lm had to be declared after -ltrio.
1313
(closes # 84)
1414

15+
2021-11-17 David Hughes
16+
* docs/hmrc.html src/parse.c
17+
Added support for strftime (3) formatting in the append_filename configuration
18+
option to allow for archived messages to be split over multiple directories
19+
(monthly or yearly for example)
20+
1521
2021-06-04 Baptiste Daroussin
1622
* src/uudecode.c src/parse.c
1723
Fixes for memory issues detected by libasan

docs/hmrc.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,11 @@ <h3><a name="sysmisc" id="sysmisc">System miscellaneous</a></h3>
13011301
<i>append = 1</i></dd>
13021302
<dd><a name="append_filename" id="append_filename"></a></dd>
13031303
<dt><strong>append_filename = [ string ]</strong></dt>
1304-
<dd>Specifies the filename to be used by the append option. $DIR may be used to specify a name relative to the directory specified in the -d or dir option. The string will be passed to strftime(3) to allow splitting the mailbox into yearly or monthy files, such as "%Y-%m.mbox". <br>
1304+
<dd>Specifies the filename to be used by the append option. $DIR may
1305+
be used to specify a name relative to the directory specified in the
1306+
-d or dir option. The string will be passed to strftime(3) to allow
1307+
splitting the mailbox into yearly or monthy files, such as
1308+
"%Y-%m.mbox". <br>
13051309
<br>
13061310
<i>append_filename = $DIR/INBOX</i></dd>
13071311
<dd><a name="txtsuffix" id="txtsuffix"></a></dd>

src/parse.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,6 @@ int parsemail(char *mbox, /* file name */
15361536
int num, isinheader, hassubject, hasdate;
15371537
int num_added = 0;
15381538
long exp_time = -1;
1539-
time_t curtime;
15401539
time_t delete_older_than = (set_delete_older ? convtoyearsecs(set_delete_older) : 0);
15411540
time_t delete_newer_than = (set_delete_newer ? convtoyearsecs(set_delete_newer) : 0);
15421541
annotation_robot_t annotation_robot = ANNOTATION_ROBOT_NONE;
@@ -1667,14 +1666,19 @@ int parsemail(char *mbox, /* file name */
16671666
*filename = 0;
16681667
*pathname = 0;
16691668
if (set_append_filename) {
1669+
time_t curtime;
1670+
const struct tm *local_curtime;
1671+
16701672
time(&curtime);
1673+
local_curtime = localtime(&curtime);
1674+
16711675
if(strncmp(set_append_filename, "$DIR/", 5) == 0) {
16721676
strncpy(directory, dir, MAXFILELEN - 1);
16731677
strftime(filename, MAXFILELEN - 1, set_append_filename+5,
1674-
localtime(&curtime));
1678+
local_curtime);
16751679
} else {
16761680
strftime(filename, MAXFILELEN - 1, set_append_filename,
1677-
localtime(&curtime));
1681+
local_curtime);
16781682
}
16791683
} else {
16801684
strncpy(directory, dir, MAXFILELEN - 1);

0 commit comments

Comments
 (0)