- if ((lc = mp->m_lines) <= 0)
- return(NOSTR);
- if (readline(ibuf, linebuf) < 0)
- return(NOSTR);
- lc--;
- do {
- lc = gethfield(ibuf, linebuf, lc);
- if (lc == -1)
- return(NOSTR);
- if (ishfield(linebuf, field))
- return(savestr(hcontents(linebuf)));
- } while (lc > 0);
- return(NOSTR);
+ if ((lc = mp->m_lines - 1) < 0)
+ return NOSTR;
+ if (readline(ibuf, linebuf, LINESIZE) < 0)
+ return NOSTR;
+ while (lc > 0) {
+ if ((lc = gethfield(ibuf, linebuf, lc, &colon)) < 0)
+ return oldhfield;
+ if (hfield = ishfield(linebuf, colon, field))
+ oldhfield = save2str(hfield, oldhfield);
+ }
+ return oldhfield;