snprintf.c revision 1
1N/A * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * Copyright (c) 1990, 1993 1N/A * The Regents of the University of California. All rights reserved. 1N/A * This code is derived from software contributed to Berkeley by 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A#
pragma ident "%Z%%M% %I% %E% SMI" 1N/A** SM_SNPRINTF -- format a string to a memory location of restricted size 1N/A** str -- memory location to place formatted string 1N/A** n -- size of buffer pointed to by str, capped to 1N/A** a maximum of INT_MAX 1N/A** fmt -- the formatting directives 1N/A** ... -- the data to satisfy the formatting 1N/A** Success: number of bytes that would have been written 1N/A** to str, not including the trailing '\0', 1N/A** up to a maximum of INT_MAX, as if there was 1N/A** no buffer size limitation. If the result >= n 1N/A** then the output was truncated. 1N/A** If n > 0, then between 0 and n-1 bytes of formatted output 1N/A** are written into 'str', followed by a '\0'. 1N/A#
else /* SM_VA_STD */ 1N/A#
endif /* SM_VA_STD */ 1N/A /* While snprintf(3) specifies size_t stdio uses an int internally */ 1N/A /* XXX put this into a static? */