fprintf.c revision 261363
1228431Sfabient/*
2228802Sfabient * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
3228431Sfabient *      All rights reserved.
4228431Sfabient * Copyright (c) 1990, 1993
5228431Sfabient *	The Regents of the University of California.  All rights reserved.
6228431Sfabient *
7228431Sfabient * This code is derived from software contributed to Berkeley by
8228431Sfabient * Chris Torek.
9228431Sfabient *
10228431Sfabient * By using this file, you agree to the terms and conditions set
11228431Sfabient * forth in the LICENSE file which can be found at the top level of
12228431Sfabient * the sendmail distribution.
13228431Sfabient */
14228431Sfabient
15228431Sfabient#include <sm/gen.h>
16228431SfabientSM_RCSID("@(#)$Id: fprintf.c,v 1.18 2013/11/22 20:51:42 ca Exp $")
17228431Sfabient#include <sm/varargs.h>
18228431Sfabient#include <sm/io.h>
19228431Sfabient#include <sm/assert.h>
20228431Sfabient#include "local.h"
21228431Sfabient
22228431Sfabient/*
23228431Sfabient**  SM_IO_FPRINTF -- format and print a string to a file pointer
24228431Sfabient**
25228431Sfabient**	Parameters:
26228431Sfabient**		fp -- file pointer to be printed to
27228431Sfabient**		timeout -- time to complete print
28228431Sfabient**		fmt -- markup format for the string to be printed
29228431Sfabient**		... -- additional information for 'fmt'
30228431Sfabient**
31228431Sfabient**	Returns:
32228431Sfabient**		Failure: returns SM_IO_EOF and sets errno
33228431Sfabient**		Success: returns the number of characters o/p
34228431Sfabient*/
35228431Sfabient
36228431Sfabientint
37228431Sfabient#if SM_VA_STD
38228431Sfabientsm_io_fprintf(SM_FILE_T *fp, int timeout, const char *fmt, ...)
39228431Sfabient#else /* SM_VA_STD */
40228431Sfabientsm_io_fprintf(fp, timeout, fmt, va_alist)
41228431Sfabient	SM_FILE_T *fp;
42228431Sfabient	int timeout;
43228431Sfabient	char *fmt;
44228431Sfabient	va_dcl
45228502Sfabient#endif /* SM_VA_STD */
46228502Sfabient{
47228502Sfabient	int ret;
48228431Sfabient	SM_VA_LOCAL_DECL
49228431Sfabient
50228431Sfabient	SM_REQUIRE_ISA(fp, SmFileMagic);
51228431Sfabient	SM_VA_START(ap, fmt);
52228431Sfabient	ret = sm_io_vfprintf(fp, timeout, fmt, ap);
53228431Sfabient	SM_VA_END(ap);
54228431Sfabient	return ret;
55228431Sfabient}
56228431Sfabient