one_snprintf

Starlink compliant wrapper around the standard snprintf function

Description:

The one_snprintf function replaces all calls to sprintf() and snprintf() to allow the use of inherited status and to trap for truncation.

Invocation

retval = one_snprintf( char str, size_t size, const char format, int status, ... );

Arguments

str = char (Returned)
Buffer to be filled from the format statement. Must be at least "size" characters in length.
size = size_t (Given)
Allocated size of buffer "str".
format = const char (Given)
Standard format string as expected by snprintf.
status = int (Given and Returned)
Inherited status. Will be set to ONE__TRUNC if the formatted version of the string does not fit into the buffer "str".
... (Given)
Variadic arguments required by snprintf.

Returned Value

int retval
Length of the string after appending. If the value exceeds the size of the supplied buffer status will be set to ONE__TRUNC but the value returned will indicate the size of the buffer that would be required to completely expand the formatted string.

Notes: