5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2007 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 #ifndef SILCSNPRINTF_H
21 #define SILCSNPRINTF_H
23 /****f* silcutil/SilcSnprintf/silc_snprintf
27 * int silc_snprintf(char *str, size_t count, const char *fmt, ...);
31 * Outputs string into `str' of maximum of size `count' including the
32 * trailing '\0' according to the `fmt'. The `fmt' is equivalent to
33 * snprintf(3) and printf(3) formatting. Returns the number of character
34 * in `str' or negative value on error.
37 int silc_snprintf(char *str, size_t count, const char *fmt, ...);
39 /****f* silcutil/SilcSnprintf/silc_vsnprintf
43 * int silc_vsnprintf(char *str, size_t count, const char *fmt,
48 * Same as silc_snprintf but takes the argument for the formatting from
49 * the `args' variable argument list.
52 int silc_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
54 /****f* silcutil/SilcSnprintf/silc_asprintf
58 * int silc_asprintf(char **ptr, const char *format, ...)
62 * Same as silc_snprintf but allocates a string large enough to hold the
63 * output including the trailing '\0'. The caller must free the `ptr'.
66 int silc_asprintf(char **ptr, const char *format, ...);
68 /****f* silcutil/SilcSnprintf/silc_vasprintf
72 * int silc_vasprintf(char **ptr, const char *format, va_list ap)
76 * Same as silc_asprintf but takes the argument from the `ap' variable
80 int silc_vasprintf(char **ptr, const char *format, va_list ap);
82 #endif /* SILCSNPRINTF_H */