summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e4bb08)
raw | patch | inline | side by side (parent: 3e4bb08)
author | Simon Sasburg <simon.sasburg@gmail.com> | |
Thu, 1 Nov 2007 22:57:45 +0000 (23:57 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 2 Nov 2007 08:58:40 +0000 (01:58 -0700) |
Signed-off-by: Simon Sasburg <Simon.Sasburg@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-mailinfo.c | patch | blob | history | |
builtin-mailsplit.c | patch | blob | history | |
t/t5100/sample.mbox | patch | blob | history |
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index fb12248f825807b085f4e5ed761002c30925ead5..2600847974f8a44bdd2148da6ff82ecf761fb193 100644 (file)
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
static int mailinfo(FILE *in, FILE *out, int ks, const char *encoding,
const char *msg, const char *patch)
{
+ int peek;
keep_subject = ks;
metainfo_charset = encoding;
fin = in;
p_hdr_data = xcalloc(MAX_HDR_PARSED, sizeof(char *));
s_hdr_data = xcalloc(MAX_HDR_PARSED, sizeof(char *));
+ do {
+ peek = fgetc(in);
+ } while (isspace(peek));
+ ungetc(peek, in);
+
/* process the email header */
while (read_one_header_line(line, sizeof(line), fin))
check_header(line, sizeof(line), p_hdr_data, 1);
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 43fc373a15cbe935054b47f9bd67c04ecf216e4e..74b04706f36128711719fff3e1423b3fb454af4c 100644 (file)
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
{
char name[PATH_MAX];
int ret = -1;
+ int peek;
FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "r");
int file_done = 0;
goto out;
}
+ do {
+ peek = fgetc(f);
+ } while (isspace(peek));
+ ungetc(peek, f);
+
if (fgets(buf, sizeof(buf), f) == NULL) {
/* empty stdin is OK */
if (f != stdin) {
diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox
index b80c981c165e9c82f56f826a0542f3bef3f13eb3..070c1661b9be8530e619cd0c297673d1e5e958a3 100644 (file)
--- a/t/t5100/sample.mbox
+++ b/t/t5100/sample.mbox
+
+
+
From nobody Mon Sep 17 00:00:00 2001
From: A U Thor <a.u.thor@example.com>
Date: Fri, 9 Jun 2006 00:44:16 -0700