190792Sgshapiro/*
2261370Sgshapiro * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
390792Sgshapiro *	All rights reserved.
490792Sgshapiro *
590792Sgshapiro * By using this file, you agree to the terms and conditions set
690792Sgshapiro * forth in the LICENSE file which can be found at the top level of
790792Sgshapiro * the sendmail distribution.
890792Sgshapiro *
9266711Sgshapiro *	$Id: varargs.h,v 1.9 2013-11-22 20:51:32 ca Exp $
1090792Sgshapiro */
1190792Sgshapiro
1290792Sgshapiro/*
1390792Sgshapiro**  libsm variable argument lists
1490792Sgshapiro*/
1590792Sgshapiro
1690792Sgshapiro#ifndef SM_VARARGS_H
1790792Sgshapiro# define SM_VARARGS_H
1890792Sgshapiro
1990792Sgshapiro# if defined(__STDC__) || defined(__cplusplus)
2090792Sgshapiro#  define SM_VA_STD 1
2190792Sgshapiro#  include <stdarg.h>
2290792Sgshapiro#  define SM_VA_START(ap, f)	va_start(ap, f)
2390792Sgshapiro# else /* defined(__STDC__) || defined(__cplusplus) */
2490792Sgshapiro#  define SM_VA_STD 0
2590792Sgshapiro#  include <varargs.h>
2690792Sgshapiro#  define SM_VA_START(ap, f)	va_start(ap)
2790792Sgshapiro# endif /* defined(__STDC__) || defined(__cplusplus) */
2890792Sgshapiro
2990792Sgshapiro# if defined(va_copy)
3090792Sgshapiro#  define SM_VA_COPY(dst, src)	va_copy((dst), (src))
3190792Sgshapiro# elif defined(__va_copy)
3290792Sgshapiro#  define SM_VA_COPY(dst, src)	__va_copy((dst), (src))
3390792Sgshapiro# else
34102528Sgshapiro#  define SM_VA_COPY(dst, src)	memcpy(&(dst), &(src), sizeof((dst)))
3590792Sgshapiro# endif
3690792Sgshapiro
3790792Sgshapiro/*
3890792Sgshapiro**  The following macros are useless, but are provided for symmetry.
3990792Sgshapiro*/
4090792Sgshapiro
4190792Sgshapiro# define SM_VA_LOCAL_DECL	va_list ap;
4290792Sgshapiro# define SM_VA_ARG(ap, type)	va_arg(ap, type)
4390792Sgshapiro# define SM_VA_END(ap)		va_end(ap)
4490792Sgshapiro
4590792Sgshapiro#endif /* ! SM_VARARGS_H */
46