summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-02 16:14:56 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-07-02 16:14:56 +0300
commit1c5b3cd3999a19b4ef404d7aafa557ae55461a48 (patch)
treefc52239549b3ca36db1feff59a97bed798b57bf3
parent45533be53dacd60ee8fa0c648e60dcc76bc83e1f (diff)
downloadmailutils-1c5b3cd3999a19b4ef404d7aafa557ae55461a48.tar.gz
mailutils-1c5b3cd3999a19b4ef404d7aafa557ae55461a48.tar.bz2
MH: fix the nodate format function
* mh/mh_format.c (builtin_nodate): Call mu_parse822_date_time directly. (mh_format_dump_disass): Escape literal strings on output. * mh/tests/fmtfunc.at: Test nodate.
-rw-r--r--mh/mh_format.c17
-rw-r--r--mh/tests/fmtfunc.at12
2 files changed, 23 insertions, 6 deletions
diff --git a/mh/mh_format.c b/mh/mh_format.c
index 48ac3a369..89a9b686e 100644
--- a/mh/mh_format.c
+++ b/mh/mh_format.c
@@ -1321,2 +1321,4 @@ builtin_nodate (struct mh_fvm *mach)
1321{ 1321{
1322 char const *date = mh_string_value (&mach->str[R_ARG]);
1323 const char *p = date;
1322 struct tm tm; 1324 struct tm tm;
@@ -1324,3 +1326,4 @@ builtin_nodate (struct mh_fvm *mach)
1324 1326
1325 mach->num[R_REG] = _parse_date (mach, &tm, &tz); 1327 mach->num[R_REG] =
1328 mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) != 0;
1326} 1329}
@@ -1904,3 +1907,4 @@ mh_format_dump_disass (mh_format_t fmt)
1904 }; 1907 };
1905 1908 static char c_trans[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
1909
1906 if (!prog) 1910 if (!prog)
@@ -1955,5 +1959,3 @@ mh_format_dump_disass (mh_format_t fmt)
1955 1959
1956 MU_ASSERT (mu_c_str_escape_trans (str, 1960 MU_ASSERT (mu_c_str_escape_trans (str, c_trans, &prt));
1957 "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v",
1958 &prt));
1959 1961
@@ -2025,4 +2027,7 @@ mh_format_dump_disass (mh_format_t fmt)
2025 char const *str = MHI_STR (prog[pc]); 2027 char const *str = MHI_STR (prog[pc]);
2028 char *prt;
2026 pc += skip; 2029 pc += skip;
2027 printf ("printlit \"%s\"", str); 2030 MU_ASSERT (mu_c_str_escape_trans (str, c_trans, &prt));
2031 printf ("printlit \"%s\"", prt);
2032 free (prt);
2028 } 2033 }
diff --git a/mh/tests/fmtfunc.at b/mh/tests/fmtfunc.at
index 113b58885..28c109a8f 100644
--- a/mh/tests/fmtfunc.at
+++ b/mh/tests/fmtfunc.at
@@ -385,5 +385,17 @@ FMTFUNC([putnumf],
385]) 385])
386
386# FIXME: putlit 387# FIXME: putlit
387 388
389FMTFUNC([nodate],
390[%(nodate{date})
391%(nodate{from})
392],
393[From: foo@example.org
394Date: Sat, 01 Jul 2017 08:00:01 +0300
388 395
396body
397],
398[0
3991
400])
389 401

Return to:

Send suggestions and report system problems to the System administrator.