/* Function: struct message *msgqueue_getmsg(MsgQueue_t *msgq, int msgno) Purpose : return a message Params : msgq - queue to obtain message from : msgno - message number Returns : pointer to message string, or NULL  */
struct message* msgqueue_getmsg(MsgQueue_t *msgq, int msgno)
/* Function: struct message *msgqueue_getmsg(MsgQueue_t *msgq, int msgno) Purpose : return a message Params : msgq - queue to obtain message from : msgno - message number Returns : pointer to message string, or NULL  */
struct message* msgqueue_getmsg(MsgQueue_t *msgq, int msgno)
{
	struct msgqueue_entry *mq;
	for (mq = msgq->qe; mq && msgno; mq = mq->next, msgno--);
	return mq ? &mq->msg : NULL;
}