From 371a2d2db2b2939c6dc8aa836db3143350d5df79 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Mon, 21 Apr 2008 14:31:39 +0000 Subject: [PATCH] Patch by Marian ??urkovi??: Support header values longer than two lines --- mbox.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mbox.c b/mbox.c index 5860abb..cb2e9f3 100644 --- a/mbox.c +++ b/mbox.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2004 Joey Schulze + Copyright (c) 2004,8 Joey Schulze This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,14 +28,15 @@ /* #define FROM_DETECTION */ +#define HDR_LEN 1024 + struct mail { - char from[128]; - char subject[128]; + char from[HDR_LEN]; + char subject[HDR_LEN]; int priority; off_t size; }; -#define HDR_LEN 1024 #define TAB 0x09 #define LWSP 0x20 @@ -182,8 +183,7 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) buf[strlen(buf)-1] = '\0'; if (inheader && !feof(f)) { - lookahead = fgetc(f); - if (lookahead == TAB || lookahead == LWSP) { + while ((lookahead=fgetc(f)) == TAB || lookahead == LWSP) { if (buf[strlen(buf)-1] != LWSP) strncat (buf, " ", sizeof(buf)-strlen(buf)-1); if ((cp = fgets(tmp, sizeof(tmp), f)) != NULL) { @@ -201,10 +201,10 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) } } } - } else - /* Rewind by one character for next read */ - if (lookahead != EOF) - fseek(f, -1, SEEK_CUR); + } + /* Rewind by one character for next read */ + if (lookahead != EOF) + fseek(f, -1, SEEK_CUR); } } else { /* Read the remainder */ -- 2.20.1