-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfprintf.h
executable file
·106 lines (96 loc) · 6.82 KB
/
sfprintf.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*****************************************************************************\
* *
* FILE NAME: callback_printf.h *
* *
* --------------------------------------------------------------------------- *
* *
* DESCRIPTION: system independent (v)s(n)printf wrapper functions *
* *
* --------------------------------------------------------------------------- *
* *
* COPYRIGHT: (c) 2024 Dipl.-Ing. Klaus Lux (Aachen, Germany) *
* *
* --------------------------------------------------------------------------- *
* *
* ORIGIN: https://github/klux21/callback_printf *
* *
* --------------------------------------------------------------------------- *
* *
* Civil Usage Public License, Version 1.1, January 2024 *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions, the explanation of terms *
* and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation or other materials provided with the distribution. *
* *
* 3. All modified files must carry prominent notices stating that the *
* files have been changed. *
* *
* 4. The source code and binary forms and any derivative works are not *
* stored or executed in systems or devices which are designed or *
* intended to harm, to kill or to forcibly immobilize people. *
* *
* 5. The source code and binary forms and any derivative works are not *
* stored or executed in systems or devices which are intended to *
* monitor, to track, to change or to control the behavior, the *
* constitution, the location or the communication of any people or *
* their property without the explicit and prior agreement of those *
* people except those devices and systems are solely designed for *
* saving or protecting peoples life or health. *
* *
* 6. The source code and binary forms and any derivative works are not *
* stored or executed in any systems or devices that are intended *
* for the production of any of the systems or devices that *
* have been stated before except the ones for saving or protecting *
* peoples life or health only. *
* *
* The term 'systems' in all clauses shall include all types and combinations *
* of physical, virtualized or simulated hardware and software and any kind *
* of data storage. *
* *
* The term 'devices' shall include any kind of local or non-local control *
* system of the stated devices as part of that device als well. Any assembly *
* of more than one device is one and the same device regarding this license. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" *
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE *
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF *
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN *
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) *
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
\*****************************************************************************/
#ifndef SFPRINTF_H
#define SFPRINTF_H
#include <stdio.h>
#include <callback_printf.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------------- *\
sfprintf is a wrapper for fprintf that bases on callback_printf.
\* ------------------------------------------------------------------------- */
size_t sfprintf(FILE * pf, const char * pFmt, ...) PRINTF_LIKE_ARGS (2, 3); /* expects a printf like format string and arguments */
/* ------------------------------------------------------------------------- *\
sfdprintf is a printf like function that bases on callback_printf and
writes to a file desciptor.
\* ------------------------------------------------------------------------- */
size_t sfdprintf(int fd, const char * pFmt, ...) PRINTF_LIKE_ARGS (2, 3); /* expects a printf like format string and arguments */
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* CALLBACK_PRINTF_H */
/* ========================================================================= *\
END OF FILE
\* ========================================================================= */