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
584820ca
...
584820ca87597c80f92d5bfff5ec58497a644088
authored
2008-02-21 16:38:30 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(DATE_SET): Fix bug introduced 2008-01-02: val can sometimes be negative.
1 parent
e4a735c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
mailbox/parsedate.y
mailbox/parsedate.y
View file @
584820c
...
...
@@ -126,12 +126,13 @@ struct pd_date
};
#define DATE_INIT(date) memset(&(date), 0, sizeof(date))
#define DATE_SET(date, memb, m, val, lim, onerror) \
do \
{ \
if (val < 0 || (lim && val >= lim)) onerror; \
date . memb = val; date.mask |= m; \
} \
#define DATE_SET(date, memb, m, val, lim, onerror) \
do \
{ \
int __x = val; \
if (((m) != PD_MASK_TZ && __x < 0) || (lim && __x >= lim)) onerror; \
date . memb = __x; date.mask |= m; \
} \
while (0)
#define __SET_SECOND(d,v,a) DATE_SET(d,second,PD_MASK_SECOND,v,60,a)
...
...
@@ -313,6 +314,7 @@ time : T_UNUMBER T_MERIDIAN
SET_TZ ($$, ($4 < 0
? -$4 % 100 + (-$4 / 100) * 60
: - ($4 % 100 + ($4 / 100) * 60)));
}
| T_UNUMBER ':' T_UNUMBER ':' T_UNUMBER o_merid
{
...
...
@@ -1190,8 +1192,7 @@ main (int argc, char *argv[])
buff[MAX_BUFF_LEN] = 0;
while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
{
d = get_date (buff, (time_t *) NULL);
if (d == -1)
if (mu_parse_date (buff, &d, NULL))
printf ("Bad format - couldn't convert.\n");
else
printf ("%s", ctime (&d));
...
...
Please
register
or
sign in
to post a comment