|
19 | 19 |
|
20 | 20 | #include <fcntl.h> |
21 | 21 |
|
| 22 | +#ifndef TRUE |
| 23 | +#define TRUE 1 |
| 24 | +#endif |
| 25 | +#ifndef FALSE |
| 26 | +#define FALSE 0 |
| 27 | +#endif |
| 28 | + |
22 | 29 | #if defined(F_SETLK) && defined(F_SETLKW) && defined(F_UNLCK) \ |
23 | 30 | && defined(F_RDLCK) && defined(F_WRLCK) |
24 | 31 | /* |
@@ -50,6 +57,13 @@ extern int log_lock(int fd, int cmd, int type, const char *name, |
50 | 57 | #endif /* #if defined(F_SETLK) && defined(F_SETLKW) && defined(F_UNLCK) |
51 | 58 | && defined(F_RDLCK) && defined(F_WRLCK) */ |
52 | 59 |
|
| 60 | +/* |
| 61 | + * log_event_ex() first argument is whether to add a newline or not. |
| 62 | + * Using FALSE is for when the same string is to be sent to log and |
| 63 | + * screen, so it already contains one. |
| 64 | + */ |
| 65 | +#define log_event(...) log_event_ex(TRUE, __VA_ARGS__) |
| 66 | + |
53 | 67 | /* |
54 | 68 | * Macro to only log something once per session. |
55 | 69 | */ |
@@ -82,11 +96,11 @@ extern void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, |
82 | 96 | */ |
83 | 97 | extern |
84 | 98 | #if (__GNUC__ == 4 && __GNUC_MINOR >= 4) || __GNUC__ > 4 |
85 | | - __attribute__ ((format (gnu_printf, 1, 2))) |
| 99 | + __attribute__ ((format (gnu_printf, 2, 3))) |
86 | 100 | #elif __GNUC__ |
87 | | - __attribute__ ((format (printf, 1, 2))) |
| 101 | + __attribute__ ((format (printf, 2, 3))) |
88 | 102 | #endif |
89 | | -void log_event(const char *format, ...); |
| 103 | +void log_event_ex(int add_nl, const char *format, ...); |
90 | 104 |
|
91 | 105 | /* |
92 | 106 | * Discards any buffered log data. |
|
0 commit comments