www.pudn.com > DTMS.rar > FETCH.C
#include "mail.h"
/* Fetch a specified record.
* We return a pointer to the null-terminated data. */
char *
mail_fetch(MAIL *mail, struct message *msg)
{
char *ptr;
if (_mail_find(mail,msg->messageid , 0) < 0) {
ptr = NULL;
printf("error in _mail_find()"); /* error, record not found */
mail->cnt_fetcherr++;
} else {
ptr = _mail_readdat(mail); /* return pointer to data */
mail->cnt_fetchok++;
}
/* Unlock the hash chain that _mail_find() locked */
if (un_lock(mail->idxfd, mail->chainoff, SEEK_SET, 1) < 0)
err_dump("un_lock error");
return(ptr);
}