/* Initialize a new Message Text Object (MTO) at the end of the provided buffer with enough room for max_len characters. Return 0 on success.  */
static int sclp_initialize_mto(struct sclp_buffer *buffer, int max_len)
/* Initialize a new Message Text Object (MTO) at the end of the provided buffer with enough room for max_len characters. Return 0 on success.  */
static int sclp_initialize_mto(struct sclp_buffer *buffer, int max_len)
{
	struct write_sccb *sccb;
	struct mto *mto;
	int mto_size;
	mto_size = sizeof(struct mto) + max_len;
	sccb = buffer->sccb;
	if ((MAX_SCCB_ROOM - sccb->header.length) < mto_size)
		return -ENOMEM;
	mto = (struct mto *)(((addr_t) sccb) + sccb->header.length);
	memset(mto, 0, sizeof(struct mto));
	mto->length = sizeof(struct mto);
	mto->type = 4;
	mto->line_type_flags = LNTPFLGS_ENDTEXT;
	buffer->current_line = (char *) (mto + 1);
	buffer->current_length = 0;
	return 0;
}