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