This is how the documentation specifies it, see mh-mail(5). The old
m_getfld(), however, was more relaxed and treated any header line that
starts with a dash as the body separator. We are more strict here,
because ``-foo: bar'' is a valid header line (according to RFC 2822),
that should thus not be treated as the body separator, whereas a line
``------'' in the header could only be a format error if we don't
take it as the body separator.
*/
static enum threestate is_falted(FILE *);
static size_t copyname(char *, char *);
*/
static enum threestate is_falted(FILE *);
static size_t copyname(char *, char *);
+static int is_separator(char *);
enum threestate falted;
nchars = getline(&tmpline, &len, msg);
enum threestate falted;
nchars = getline(&tmpline, &len, msg);
if (feof(msg)) {
return FILEEOF2;
} else {
if (feof(msg)) {
return FILEEOF2;
} else {
- if (nchars > 0 && (*tmpline == '\n' || *tmpline == '-')) {
+ if (is_separator(tmpline)) {
/* header/body separator found */
free(tmpline);
return m_getfld2(BODY2, f, msg);
/* header/body separator found */
free(tmpline);
return m_getfld2(BODY2, f, msg);
+
+static int
+is_separator(char *line)
+{
+ /*
+ ** In MH, lines that are consists of dashes only are
+ ** separators as well ... not so in RFC 822.
+ */
+ while (*line == '-') {
+ line++;
+ }
+ if (strcmp("\n", line)==0) {
+ return 1;
+ }
+ return 0;
+}