diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-09-01 23:01:45 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-09-01 23:01:45 +0200 |
commit | 20d8cd0d63ee265870629243a31a60622ffafd99 (patch) | |
tree | bd19a6462ea4a3df8ed64f4e5b1bfea4c957c476 /sys/src/cmd/upas/common | |
parent | feda48624bd8e5a321e81fbe19e45afa959d1367 (diff) |
upas: appendfolder(): skip the address from unix header before date
Diffstat (limited to 'sys/src/cmd/upas/common')
-rw-r--r-- | sys/src/cmd/upas/common/folder.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/src/cmd/upas/common/folder.c b/sys/src/cmd/upas/common/folder.c index 98120850d..5aeddc544 100644 --- a/sys/src/cmd/upas/common/folder.c +++ b/sys/src/cmd/upas/common/folder.c @@ -186,8 +186,8 @@ mboxesc(Biobuf *in, Biobuf *out, int type) int appendfolder(Biobuf *b, char *addr, int fd) { - char *s; - int r, n; + char *s, *t; + int r; Biobuf bin; Folder *f; Tm tm; @@ -196,10 +196,11 @@ appendfolder(Biobuf *b, char *addr, int fd) Bseek(f->out, 0, 2); Binit(&bin, fd, OREAD); s = Brdstr(&bin, '\n', 0); - n = strlen(s); - if(!s || strncmp(s, "From ", 5) != 0) + if(s == nil || strncmp(s, "From ", 5) != 0) Bprint(f->out, "From %s %.28s\n", addr, ctime(f->t)); - else if(n > 5 && tmparse(&tm, Ctimefmt, s + 5, nil, nil) != nil) + else if(strncmp(s, "From ", 5) == 0 + && (t = strchr(s + 5, ' ')) != nil + && tmparse(&tm, Ctimefmt, t + 1, nil, nil) != nil) f->t = tm2sec(&tm); if(s) Bwrite(f->out, s, strlen(s)); |