xref: /onnv-gate/usr/src/cmd/sendmail/libsm/fprintf.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3*0Sstevel@tonic-gate  *      All rights reserved.
4*0Sstevel@tonic-gate  * Copyright (c) 1990, 1993
5*0Sstevel@tonic-gate  *	The Regents of the University of California.  All rights reserved.
6*0Sstevel@tonic-gate  *
7*0Sstevel@tonic-gate  * This code is derived from software contributed to Berkeley by
8*0Sstevel@tonic-gate  * Chris Torek.
9*0Sstevel@tonic-gate  *
10*0Sstevel@tonic-gate  * By using this file, you agree to the terms and conditions set
11*0Sstevel@tonic-gate  * forth in the LICENSE file which can be found at the top level of
12*0Sstevel@tonic-gate  * the sendmail distribution.
13*0Sstevel@tonic-gate  */
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
16*0Sstevel@tonic-gate 
17*0Sstevel@tonic-gate #include <sm/gen.h>
18*0Sstevel@tonic-gate SM_RCSID("@(#)$Id: fprintf.c,v 1.15 2001/03/02 23:53:41 ca Exp $")
19*0Sstevel@tonic-gate #include <sm/varargs.h>
20*0Sstevel@tonic-gate #include <sm/io.h>
21*0Sstevel@tonic-gate #include <sm/assert.h>
22*0Sstevel@tonic-gate #include "local.h"
23*0Sstevel@tonic-gate 
24*0Sstevel@tonic-gate /*
25*0Sstevel@tonic-gate **  SM_IO_FPRINTF -- format and print a string to a file pointer
26*0Sstevel@tonic-gate **
27*0Sstevel@tonic-gate **	Parameters:
28*0Sstevel@tonic-gate **		fp -- file pointer to be printed to
29*0Sstevel@tonic-gate **		timeout -- time to complete print
30*0Sstevel@tonic-gate **		fmt -- markup format for the string to be printed
31*0Sstevel@tonic-gate **		... -- additional information for 'fmt'
32*0Sstevel@tonic-gate **
33*0Sstevel@tonic-gate **	Returns:
34*0Sstevel@tonic-gate **		Failure: returns SM_IO_EOF and sets errno
35*0Sstevel@tonic-gate **		Success: returns the number of characters o/p
36*0Sstevel@tonic-gate */
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate int
39*0Sstevel@tonic-gate #if SM_VA_STD
sm_io_fprintf(SM_FILE_T * fp,int timeout,const char * fmt,...)40*0Sstevel@tonic-gate sm_io_fprintf(SM_FILE_T *fp, int timeout, const char *fmt, ...)
41*0Sstevel@tonic-gate #else /* SM_VA_STD */
42*0Sstevel@tonic-gate sm_io_fprintf(fp, timeout, fmt, va_alist)
43*0Sstevel@tonic-gate 	SM_FILE_T *fp;
44*0Sstevel@tonic-gate 	int timeout;
45*0Sstevel@tonic-gate 	char *fmt;
46*0Sstevel@tonic-gate 	va_dcl
47*0Sstevel@tonic-gate #endif /* SM_VA_STD */
48*0Sstevel@tonic-gate {
49*0Sstevel@tonic-gate 	int ret;
50*0Sstevel@tonic-gate 	SM_VA_LOCAL_DECL
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate 	SM_REQUIRE_ISA(fp, SmFileMagic);
53*0Sstevel@tonic-gate 	SM_VA_START(ap, fmt);
54*0Sstevel@tonic-gate 	ret = sm_io_vfprintf(fp, timeout, fmt, ap);
55*0Sstevel@tonic-gate 	SM_VA_END(ap);
56*0Sstevel@tonic-gate 	return ret;
57*0Sstevel@tonic-gate }
58