-
Notifications
You must be signed in to change notification settings - Fork 2
/
snprintf.h
40 lines (33 loc) · 1.05 KB
/
snprintf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef SNPRINTF_H
#define SNPRINTF_H
/* ===================================================================
* snprintf.h
*
* This is from
* W. Richard Stevens, 'UNIX Network Programming', Vol 1, 2nd Edition,
* Prentice Hall, 1998.
*
* Mark Gates <[email protected]>
* July 1998
*
* to use this prototype, make sure HAVE_SNPRINTF is not defined
*
* =================================================================== */
/*
* Throughout the book I use snprintf() because it's safer than sprintf().
* But as of the time of this writing, not all systems provide this
* function. The function below should only be built on those systems
* that do not provide a real snprintf().
* The function below just acts like sprintf(); it is not safe, but it
* tries to detect overflow.
*/
#ifndef HAVE_SNPRINTF
#ifdef __cplusplus
extern "C" {
#endif
int snprintf(char *buf, size_t size, const char *fmt, ...);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* HAVE_SNPRINTF */
#endif /* SNPRINTF_H */