/*
 * Copyright (c) 2002 Sendmail, Inc. and its suppliers.
 *      All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 */

#include "sm/generic.h"
SM_RCSID("@(#)$Id: fput2int.c,v 1.2 2006/07/14 14:42:25 ca Exp $")
#include "sm/error.h"
#include "sm/types.h"
#include "sm/io.h"
#include "sm/assert.h"
#include "io-int.h"
#include "fvwrite.h"

/*
**  SM_IO_FPUT2UINT32 -- add 2 32bit integers to the buffer for the file pointer
**
**	Parameters:
**		fp -- the file pointer for the buffer to be written to
**		n1 -- int to be placed in the buffer
**		n2 -- int to be placed in the buffer
**
**	Returns:
**		usual sm_error code
*/

sm_ret_T
sm_io_fput2uint32(sm_file_T *fp, uint32_t n1, uint32_t n2)
{
	sm_uio_T uio;
	sm_iov_T iov[2];

	SM_IS_FP(fp);
	iov[0].iov_base = (void *) &n1;
	iov[0].iov_len = sizeof(uint32_t);
	iov[1].iov_base = (void *) &n2;
	iov[1].iov_len = sizeof(uint32_t);
	uio.uio_resid = 2 * sizeof(uint32_t);
	uio.uio_iov = &(iov[0]);
	uio.uio_iovcnt = 2;
	return sm_fvwrite(fp, &uio);
}


syntax highlighted by Code2HTML, v. 0.9.1