|
From: <il...@pr...> - 2005-02-03 14:43:17
|
Update of /cvsroot/meshdb/src/mailt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11232 Modified Files: index.h mkill.c msgid.c t.c update.c util.c view.c Log Message: More endianness fixes. Index: index.h =================================================================== RCS file: /cvsroot/meshdb/src/mailt/index.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- index.h 29 Jan 2005 04:37:45 -0000 1.2 +++ index.h 3 Feb 2005 14:43:06 -0000 1.3 @@ -53,6 +53,6 @@ #define READONLY 1 #define READWRITE 0 -#define CHILD(o,i) ((o)->m[(i)].child) -#define SIBLING(o,i) ((o)->m[(i)].sibling) -#define PARENT(o,i) ((o)->m[(i)].parent) +#define CHILD(o,i) (betoh32((o)->m[(i)].child)) +#define SIBLING(o,i) (betoh32((o)->m[(i)].sibling)) +#define PARENT(o,i) (betoh32((o)->m[(i)].parent)) Index: mkill.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/mkill.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mkill.c 29 Jan 2005 13:08:41 -0000 1.4 +++ mkill.c 3 Feb 2005 14:43:07 -0000 1.5 @@ -66,12 +66,12 @@ m = o.m; m0 = o.m0; mbox = o.mbox; + msgs = betoh32(m0->msgs); if (mid == NULL) { /* List killed messages */ - msgs = betoh32(m0->msgs); - for (i = 1; i < m0->msgs; i++) - if (m[i].flags & FLAGS_KILLED) { + for (i = 1; i < msgs; i++) + if (betoh32(m[i].flags) & FLAGS_KILLED) { if (nflag) /* Only show numbers if -n given */ printf("%lu\n", (unsigned long)i); @@ -86,16 +86,16 @@ /* Search for the first message with that ID */ if (nflag) { i = atoi(mid); - if (i < 1 || i >= m0->msgs) { + if (i < 1 || i >= msgs) { fprintf(stderr, "index '%s' out of range\n", mid); exit(1); } kid = i; } else { midend = mid + strlen(mid); - for (i = 1; i < m0->msgs; i++) { + for (i = 1; i < msgs; i++) { cstring_t s, e; - if ((m[i].flags & FLAGS_KILLED) == FLAGS_KILLED) + if ((betoh32(m[i].flags) & FLAGS_KILLED) == FLAGS_KILLED) continue; if (find1hdr(m+i, mbox, "message-id", &s, &e) && msgid(s, e, &s, &e) && @@ -104,24 +104,24 @@ break; } } - if (i >= m0->msgs) { + if (i >= msgs) { fprintf(stderr, "couldn't find message-id <%s>\n", mid); exit(1); } } if (uflag) { - if ((m[kid].flags & FLAGS_KILLED) == 0) { + if ((betoh32(m[kid].flags) & FLAGS_KILLED) == 0) { fprintf(stderr, "message already killed\n"); exit(1); } /* Modify kill flag */ - m[kid].flags &= ~FLAGS_KILLED; + m[kid].flags &= betoh32(~FLAGS_KILLED); /* Insert into beginning of tree */ - m[kid].parent = 0; - m[kid].child = 0; - m[kid].sibling = m[0].child; + m[kid].parent = betoh32(0); + m[kid].child = betoh32(0); + m[kid].sibling = betoh32(m[0].child); m[0].child = kid; printf("unkilled message #%lu\n", (unsigned long)kid); @@ -129,18 +129,18 @@ "to rebuild the index.\n"); } else { /* Find the link in the reply-tree to the doomed node */ - for (sp = &m[m[kid].parent].child; *sp; sp = &m[*sp].sibling) - if (*sp == kid) + for (sp = &m[betoh32(m[kid].parent)].child; *sp; sp = &m[betoh32(*sp)].sibling) + if (betoh32(*sp) == kid) break; - if (*sp != kid) { + if (betoh32(*sp) != kid) { fprintf(stderr, "reply-tree corrupt\n"); exit(1); } /* Reparent all of its children. */ - for (lasti = 0, i = m[kid].child; i; - lasti = i, i = m[i].sibling) + for (lasti = 0, i = betoh32(m[kid].child); i; + lasti = i, i = betoh32(m[i].sibling)) m[i].parent = m[kid].parent; - if (m[kid].child) { + if (betoh32(m[kid].child)) { /* * insert the child list into where the doomed * node was. XXX - DATES WILL NOT BE CONSISTENT!! @@ -155,12 +155,12 @@ *sp = m[kid].sibling; /* Unlink the doomed node from the tree */ - m[kid].parent = 0; - m[kid].sibling = 0; - m[kid].child = 0; + m[kid].parent = betoh32(0); + m[kid].sibling = betoh32(0); + m[kid].child = betoh32(0); /* Modify the kill flag */ - m[kid].flags |= FLAGS_KILLED; + m[kid].flags |= betoh32(FLAGS_KILLED); printf("killed message #%lu\n", (unsigned long)kid); } Index: msgid.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/msgid.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- msgid.c 29 Jan 2005 13:08:41 -0000 1.3 +++ msgid.c 3 Feb 2005 14:43:07 -0000 1.4 @@ -21,6 +21,7 @@ struct open o; struct mail0 *m0; struct mail *m; + uint32_t msgs; msgid_t i, kid; cstring_t mbox, mid, midend; int error = 0; @@ -55,13 +56,14 @@ m = o.m; m0 = o.m0; mbox = o.mbox; + msgs = betoh32(m0->msgs); /* Search for the first message with that ID */ if (mid) midend = mid + strlen(mid); - for (i = 1; i < m0->msgs; i++) { + for (i = 1; i < msgs; i++) { cstring_t s, e; - if ((m[i].flags & FLAGS_KILLED) == FLAGS_KILLED) + if ((betoh32(m[i].flags) & FLAGS_KILLED) == FLAGS_KILLED) continue; if (find1hdr(m+i, mbox, "message-id", &s, &e) && msgid(s, e, &s, &e)) @@ -77,7 +79,7 @@ if (mid) { - if (i >= m0->msgs) { + if (i >= msgs) { fprintf(stderr, "couldn't find message-id <%s>\n", mid); exit(1); } Index: t.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/t.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- t.c 29 Jan 2005 13:08:41 -0000 1.3 +++ t.c 3 Feb 2005 14:43:07 -0000 1.4 @@ -13,10 +13,12 @@ int level; { static char when[80]; + time_t date; do { if (i) { + date = o->m[i].date; strftime(when, sizeof when, "%e-%b-%y", - localtime(&o->m[i].date)); + localtime(&date)); printf("%*s* %lu %.20s, %.50s %s\n", level * 3, "", (unsigned long)i, o->m[i].from, @@ -26,12 +28,12 @@ printf("%*s* %lu <root>\n", level * 3, "", (unsigned long)i); - if (o->m[i].child) { - printit(o, o->m[i].child, level + 1); - if (o->m[o->m[i].child].parent != i) + if (betoh32(o->m[i].child)) { + printit(o, betoh32(o->m[i].child), level + 1); + if (betoh32(o->m[betoh32(o->m[i].child)].parent) != i) printf("@@### WRONG PARENT\n"); } - i = o->m[i].sibling; + i = betoh32(o->m[i].sibling); } while (i); } Index: update.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/update.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- update.c 29 Jan 2005 13:08:42 -0000 1.4 +++ update.c 3 Feb 2005 14:43:07 -0000 1.5 @@ -90,6 +90,7 @@ struct mail *m = o->m; cstring_t mbox = o->mbox; struct mail0 *m0 = o->m0; + uint32_t msgs; struct hashent *h; hash_t tab; int i, j, hashval; @@ -100,7 +101,8 @@ fprintf(stderr, "malloc failed\n"); return NULL; } - tab->ents = (struct hashent *)malloc(m0->msgs * sizeof (struct hashent)); + msgs = betoh32(m0->msgs); + tab->ents = (struct hashent *)malloc(msgs * sizeof (struct hashent)); if (tab->ents == NULL) { fprintf(stderr, "malloc failed\n"); return NULL; @@ -108,8 +110,8 @@ for (i = 0; i < HASHLEN; i++) tab->entry[i] = NULL; - for (i = 1; i < m0->msgs; i++) { - if (m[i].flags & FLAGS_KILLED) + for (i = 1; i < msgs; i++) { + if (betoh32(m[i].flags) & FLAGS_KILLED) continue; h = &(tab->ents[i]); h->next = NULL; @@ -117,7 +119,7 @@ if (!msgid(hstart, hend, &h->start, &h->end)) { fprintf(stderr, "message %d: bad message-id\n", i); - m[i].flags |= FLAGS_KILLED; + m[i].flags |= betoh32(FLAGS_KILLED); continue; } j = find_msgbyid(tab, h->start, h->end); @@ -125,7 +127,7 @@ fflush(stdout); fprintf(stderr, "Message %d has same Message-ID" " as message %d: killing.\n", i, j); - m[i].flags |= FLAGS_KILLED; + m[i].flags |= betoh32(FLAGS_KILLED); h->start = h->end = NULL; hashval = -1; } else { @@ -167,12 +169,12 @@ break; } - m->pos = start-mbox; - m->hdrlen = p - start; - m->bodylen = end - p; - m->child = 0; - m->sibling = 0; - m->parent = 0; + m->pos = betoh64(start-mbox); + m->hdrlen = betoh32(p - start); + m->bodylen = betoh32(end - p); + m->child = betoh32(0); + m->sibling = betoh32(0); + m->parent = betoh32(0); if (find1hdr(m, mbox, "subject", &hstart, &hend)) { cstring_t t; @@ -242,12 +244,12 @@ tm.tm_isdst = -1; m->date = mktime(&tm); - if (index > 1 && m->date < (m-1)->date) { + if (index > 1 && betoh32(m->date) < betoh32((m-1)->date)) { fprintf(stderr, "msg %lu: warning: date bad, fixing\n" "\t('%.*s' earlier than '%.24s')\n", (unsigned long)index, start-p - 1, p, ctime(&(m-1)->date)); - m->date = (m-1)->date + 1; + m->date = betoh32(betoh32((m-1)->date) + 1); } #else /* Parse the Date header */ @@ -259,24 +261,25 @@ tm.tm_gmtoff = 0; tm.tm_zone = NULL; tm.tm_isdst = -1; - m->date = mktime(&tm); - if (m->date > 0) - m->date -= gmtoff; + m->date = betoh32(mktime(&tm)); + if (betoh32(m->date) > 0) + m->date = betoh32(betoh32(m->date) - gmtoff); else - m->date = -1; + m->date = betoh32(-1); } else - m->date = -1; + m->date = betoh32(-1); #endif if (vflag) { char buf[80] = "INVALID"; - if (m->date != -1) + if (betoh32(m->date) != -1) strftime(buf, sizeof buf, "%a, %e %b %Y %H:%M:%S GMT", &tm); printf("Message %lu '%.10s' from '%.10s' date '%s'\n" "\tpos %llu hdrlen %d bodylen %d\n", (unsigned long)index, m->subject, m->from, buf, - (unsigned long long)m->pos, (int)m->hdrlen, - (int)m->bodylen); + (unsigned long long)betoh64(m->pos), + (int)betoh32(m->hdrlen), + (int)betoh32(m->bodylen)); } } @@ -300,16 +303,16 @@ /* Just load the zero entry to find the old mailbox size */ if ((m0 = (struct mail0 *)index_loadn(idxfd, 1, READWRITE)) == NULL) exit(1); - oldend = m0->end; + oldend = betoh64(m0->end); if (oldend == sb.st_size) { /* No change detected */ index_unloadn((struct mail *)m0, 1); return 0; } - m0->end = sb.st_size; + m0->end = betoh64(sb.st_size); if ((mbox = mbox_map(m0, mboxfd)) == NULL) { - m0->end = oldend; + m0->end = betoh64(oldend); exit(1); } @@ -317,7 +320,7 @@ if (memcmp(p, From, sizeof From) != 0) { fprintf(stderr, "Changes to mbox do not start with '%.*s'\n", (int)sizeof From, From); - m0->end = oldend; + m0->end = betoh64(oldend); exit(1); } newmsgs = 1; @@ -328,12 +331,12 @@ /* Expand the index file to cpe with the new messages */ mbox_unmap(m0, mbox); - m0->msgs += newmsgs; + m0->msgs = betoh32(betoh32(m0->msgs) + newmsgs); #if 0 #define st_mtime st_mtimespec.tv_sec #endif - m0->date = sb.st_mtime; - msgs = m0->msgs; + m0->date = betoh32(sb.st_mtime); + msgs = betoh32(m0->msgs); index_unloadn((struct mail *)m0, 1); m0 = NULL; if (index_resize(idxfd, msgs) == -1) @@ -381,11 +384,11 @@ m0 = o->m0; m = o->m; mbox = o->mbox; - end = mbox + m0->end; + end = mbox + betoh64(m0->end); /* if not -r, check the consistency of the existing reply tree */ if (!rflag) { - if (!check_reply_tree(m, m0->msgs - newmsgs, oldend)) { + if (!check_reply_tree(m, betoh32(m0->msgs) - newmsgs, oldend)) { fprintf(stderr, "Re-run with -r flag!\n"); exit(1); } @@ -396,7 +399,7 @@ /* Find each 'From '-commenced message */ start = p = mbox + oldend; - index = m0->msgs - newmsgs; + index = betoh32(m0->msgs) - newmsgs; for (p += sizeof From; p < end - sizeof From - 1; p++) /* Look for the beginning of the next message */ if (*p == '\n' && memcmp(p + 1, From, sizeof From) @@ -428,22 +431,22 @@ if (rflag) { if (vflag) printf("re-building reply-tree from scratch\n"); - m[0].child = 0; - for (i = 1; i < m0->msgs; i++) - m[i].child = m[i].parent = m[i].sibling = 0; + m[0].child = betoh32(0); + for (i = 1; i < betoh32(m0->msgs); i++) + m[i].child = m[i].parent = m[i].sibling = betoh32(0); } /* * Look at the new messages's In-reply-to and References headers * and insert them into the reply-tree accordingly. */ - for (i = rflag ? 1 : m0->msgs - newmsgs; i < m0->msgs; i++) { + for (i = rflag ? 1 : betoh32(m0->msgs) - newmsgs; i < betoh32(m0->msgs); i++) { cstring_t istart, iend; msgid_t parent = 0; msgid_t *jp; /* Ignore killed messages */ - if (m[i].flags & FLAGS_KILLED) + if (betoh32(m[i].flags) & FLAGS_KILLED) continue; if (find1hdr(&m[i], mbox, "in-reply-to", &istart, &iend) @@ -486,7 +489,7 @@ } if (subj != m[i].subject && subj[0] != '\0') - for (j = m[0].child; j; j = m[j].sibling) { + for (j = betoh32(m[0].child); j; j = betoh32(m[j].sibling)) { /* Skip the Re */ const char *subj2 = m[j].subject; while (tolower(subj2[0]) == 'r' && @@ -509,18 +512,18 @@ } if (parent == 0 && last0 && last0 < i - && m[last0].sibling == 0) + && betoh32(m[last0].sibling) == 0) /* Common case is that 0 holds all the messages */ jp = &m[last0].sibling; else /* Walk existing siblings till we find a later one or the end */ - for (jp = &m[parent].child; *jp; jp = &m[*jp].sibling) - if (*jp > i) + for (jp = &m[parent].child; betoh32(*jp); jp = &m[betoh32(*jp)].sibling) + if (betoh32(*jp) > i) break; - m[i].parent = parent; - m[i].child = 0; - m[i].sibling = *jp; - *jp = i; + m[i].parent = betoh32(parent); + m[i].child = betoh32(0); + m[i].sibling = betoh32(*jp); + *jp = betoh32(i); if (parent == 0) last0 = i; } Index: util.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/util.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- util.c 3 Feb 2005 14:05:49 -0000 1.4 +++ util.c 3 Feb 2005 14:43:07 -0000 1.5 @@ -186,7 +186,9 @@ cstring_t mbox; cstring_t name, *startp, *endp; { - findhdr(mbox + m->pos, mbox + m->pos + m->hdrlen, name, startp, endp); + findhdr(mbox + betoh64(m->pos), + mbox + betoh64(m->pos) + betoh32(m->hdrlen), + name, startp, endp); return (*startp != NULL); } @@ -222,11 +224,11 @@ /* initialise the 'seen' array */ for (i = 0; i < msgs; i++) - seen[i] = (m[i].flags & FLAGS_KILLED) ? -1 : 0; + seen[i] = (betoh32(m[i].flags) & FLAGS_KILLED) ? -1 : 0; /* Recursively check children */ - if (m[0].child) - if (!check_reply_sub(m, m[0].child, seen, msgs, end)) + if (betoh32(m[0].child)) + if (!check_reply_sub(m, betoh32(m[0].child), seen, msgs, end)) return 0; /* look at the contents of the 'seen' list */ @@ -284,30 +286,30 @@ seen[i] = 1; /* Check message body and header extents against file size */ - if (m[i].pos + m[i].bodylen + m[i].hdrlen > end) + if (betoh64(m[i].pos) + betoh32(m[i].bodylen) + betoh32(m[i].hdrlen) > end) fprintf(stderr, "msg %lu: exceeds bounds\n", (unsigned long)i); - if (m[i].child) { + if (betoh32(m[i].child)) { /* Check parental back-link */ - if (m[m[i].child].parent != i) { + if (betoh32(m[betoh32(m[i].child)].parent) != i) { fprintf(stderr, "msg %lu: bad parent", - (unsigned long)m[i].child); + (unsigned long)betoh32(m[i].child)); return 0; } /* Recurse */ - if (!check_reply_sub(m, m[i].child, seen, max, end)) + if (!check_reply_sub(m, betoh32(m[i].child), seen, max, end)) return 0; } - if (m[i].sibling) { + if (betoh32(m[i].sibling)) { /* Check parental back-link */ - if (m[m[i].sibling].parent != m[i].parent) { + if (betoh32(m[betoh32(m[i].sibling)].parent) != betoh32(m[i].parent)) { fprintf(stderr, "msg %lu: bad parent", - (unsigned long)m[i].child); + (unsigned long)betoh32(m[i].child)); return 0; } /* Recurse */ - if (!check_reply_sub(m, m[i].sibling, seen, max, end)) + if (!check_reply_sub(m, betoh32(m[i].sibling), seen, max, end)) return 0; } Index: view.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/view.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- view.c 29 Jan 2005 13:08:42 -0000 1.5 +++ view.c 3 Feb 2005 14:43:07 -0000 1.6 @@ -236,14 +236,14 @@ { if (id == 0) return 0; - if (o->m[id].child) - return o->m[id].child; - while (!o->m[id].sibling) { - id = o->m[id].parent; + if (betoh32(o->m[id].child)) + return betoh32(o->m[id].child); + while (!betoh32(o->m[id].sibling)) { + id = betoh32(o->m[id].parent); if (!id) return 0; } - return o->m[id].sibling; + return betoh32(o->m[id].sibling); } /* Return previous sibling or parent if none */ @@ -256,15 +256,15 @@ if (id == 0) return 0; - parent = o->m[id].parent; - i = o->m[parent].child; + parent = betoh32(o->m[id].parent); + i = betoh32(o->m[parent].child); if (i == id) return parent; - while (o->m[i].sibling) - if (o->m[i].sibling == id) + while (betoh32(o->m[i].sibling)) + if (betoh32(o->m[i].sibling) == id) return i; else - i = o->m[i].sibling; + i = betoh32(o->m[i].sibling); /* XXX should not be reached */ fprintf(stderr, "corrupt index tree\n"); exit(1); @@ -302,7 +302,9 @@ struct mail *m = &o->m[id]; printf("Content-type: text/plain\n\n"); - fwrite(o->mbox + m->pos, m->bodylen + m->hdrlen, 1, stdout); + fwrite(o->mbox + betoh64(m->pos), + betoh32(m->bodylen) + betoh32(m->hdrlen), + 1, stdout); } /* Print related article subjects in a tree. */ @@ -313,6 +315,7 @@ int nosib, nochld; { char when[256]; + time_t date; if (id == 0) return; @@ -333,12 +336,13 @@ printesc(o->m[id].from, o->m[id].from + strlen(o->m[id].from)); printf("</SPAN>"); - strftime(when, sizeof when, "%e%b%y", localtime(&o->m[id].date)); + date = betoh32(o->m[id].date); + strftime(when, sizeof when, "%e%b%y", localtime(&date)); printf(", <SPAN CLASS=shortdate>%s</SPAN> ", when); - if (o->m[id].child) { + if (betoh32(o->m[id].child)) { if (nochld) { - int replies = counttree(o, o->m[id].child); + int replies = counttree(o, betoh32(o->m[id].child)); printf("<SPAN CLASS=replies>["); if (replies == 1) @@ -348,15 +352,15 @@ printf("]</SPAN>"); } else { printf("<UL>\n"); - print_threadlist(o, o->m[id].child, displayed, 0, 0); + print_threadlist(o, betoh32(o->m[id].child), displayed, 0, 0); printf("</UL>\n"); } } printf("</LI>\n"); - if (!nosib && o->m[id].sibling) - print_threadlist(o, o->m[id].sibling, displayed, 0, 0); + if (!nosib && betoh32(o->m[id].sibling)) + print_threadlist(o, betoh32(o->m[id].sibling), displayed, 0, 0); } struct idchain { @@ -506,8 +510,8 @@ if (!killed) { /* Start is the most distant ancestor */ start = id; - while (o->m[start].parent) - start = o->m[start].parent; + while (betoh32(o->m[start].parent)) + start = betoh32(o->m[start].parent); /* Find the previous sibling */ next = findnext(o, id); @@ -549,8 +553,8 @@ } printf("<TABLE CLASS=header>"); - ha = o->mbox + m->pos; - hb = o->mbox + m->pos + m->hdrlen; + ha = o->mbox + betoh64(m->pos); + hb = o->mbox + betoh64(m->pos) + betoh32(m->hdrlen); if (findhdr(ha, hb, "from", &s, &e)) { printf("<TR><TH>From:</TH><TD><SPAN CLASS=email>"); printesc(s, e); @@ -588,8 +592,8 @@ if (findhdr(ha, hb, "content-type", &hs, &he)) { cstring_t *v; v = hdr_split(hs, he); - s = o->mbox + m->pos; - e = s + m->hdrlen + m->bodylen; + s = o->mbox + betoh64(m->pos); + e = s + betoh32(m->hdrlen) + betoh32(m->bodylen); if (!v[0] || !*v[0] || strcasecmp(v[0], "text/plain") == 0) goto textplain; else if (strcasecmp(v[0], "multipart/mixed") == 0) @@ -606,8 +610,8 @@ textplain: qp = isqp(ha, hb); - bodystart = o->mbox + m->pos + m->hdrlen; - bodyend = bodystart + m->bodylen; + bodystart = o->mbox + betoh64(m->pos) + betoh32(m->hdrlen); + bodyend = bodystart + betoh32(m->bodylen); printf("<PRE WRAP=AUTO>"); #if 1 @@ -667,7 +671,7 @@ printf("<UL CLASS=thread>"); print_threadlist(o, findprevsib(o, start), id, 1, 1); print_threadlist(o, start, id, 1, 0); - print_threadlist(o, o->m[start].sibling, id, 1, 1); + print_threadlist(o, betoh32(o->m[start].sibling), id, 1, 1); printf("</UL>\n"); } @@ -809,7 +813,7 @@ raw = (strcmp(p, ";raw") == 0); /* Check first part of path component is valid message ID */ - if (path[0] < 1 || path[0] >= o.m0->msgs) { + if (path[0] < 1 || path[0] >= betoh32(o.m0->msgs)) { printf("Content-type: text/plain\n\n"); printf("error: invalid message ID\n"); exit(0); @@ -829,8 +833,8 @@ else { struct mail *m = &o.m[path[0]]; - show_mime_part(&o, o.mbox + m->pos, - o.mbox + m->pos + m->hdrlen + m->bodylen, + show_mime_part(&o, o.mbox + betoh64(m->pos), + o.mbox + betoh64(m->pos) + betoh32(m->hdrlen) + betoh32(m->bodylen), path + 1, pathlen - 1); } |