Vitezslav Samel (3): packet.c: do not poll() for key press when not needed usage.c: fix spelling (*_buildin() --> *_builtin()) define __attribute__((format(printf, x, y))) as __printf(x,y)
src/error.h | 2 +- src/iptraf-ng-compat.h | 12 ++++++------ src/packet.c | 2 +- src/tui/msgboxes.h | 2 +- src/usage.c | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-)
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/packet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/packet.c b/src/packet.c index 841a573..20f20bf 100644 --- a/src/packet.c +++ b/src/packet.c @@ -103,7 +103,7 @@ int packet_get(int fd, struct pkt_hdr *pkt, int *ch, WINDOW *win) nfds++;
/* Monitor stdin only if in interactive, not daemon mode. */ - if (!daemonized) { + if (ch && !daemonized) { pfds[1].fd = 0; pfds[1].events = POLLIN; nfds++;
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/usage.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/usage.c b/src/usage.c index 477facb..9c32cbc 100644 --- a/src/usage.c +++ b/src/usage.c @@ -11,13 +11,13 @@ static void vreportf(const char *prefix, const char *err, va_list params) fprintf(stderr, "%s%s\n", prefix, msg); }
-static __noreturn void die_buildin(const char *err, va_list params) +static __noreturn void die_builtin(const char *err, va_list params) { vreportf("fatal: ", err, params); exit(129); }
-static void error_buildin(const char *err, va_list params) +static void error_builtin(const char *err, va_list params) { vreportf("error: ", err, params); } @@ -27,7 +27,7 @@ void die(const char *err, ...) va_list params;
va_start(params, err); - die_buildin(err, params); + die_builtin(err, params); va_end(params); }
@@ -36,7 +36,7 @@ void error(const char *err, ...) va_list params;
va_start(params, err); - error_buildin(err, params); + error_builtin(err, params); va_end(params); }
@@ -64,6 +64,6 @@ void die_errno(const char *fmt, ...) snprintf(fmt_with_err, sizeof(fmt_with_err), "%s: %s", fmt, str_error);
va_start(params, fmt); - die_buildin(fmt_with_err, params); + die_builtin(fmt_with_err, params); va_end(params); }
... and use it all over the place
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/error.h | 2 +- src/iptraf-ng-compat.h | 12 ++++++------ src/tui/msgboxes.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/error.h b/src/error.h index 7881c41..73dbb29 100644 --- a/src/error.h +++ b/src/error.h @@ -1,6 +1,6 @@ #ifndef IPTRAF_NG_ERROR_H #define IPTRAF_NG_ERROR_H
-void write_error(char *msg, ...) __attribute__((format (printf, 1, 2))); +void write_error(char *msg, ...) __printf(1,2);
#endif /* IPTRAF_NG_ERROR_H */ diff --git a/src/iptraf-ng-compat.h b/src/iptraf-ng-compat.h index f055c82..8aa0be0 100644 --- a/src/iptraf-ng-compat.h +++ b/src/iptraf-ng-compat.h @@ -57,9 +57,9 @@ #define dispmode(mode) \ (((mode) == KBITS) ? "kbps": "kBps")
-#define __noreturn __attribute__((noreturn)) -#define __unused __attribute__((unused)) -#define __format __attribute__((format(printf, 1, 2))) +#define __noreturn __attribute__((noreturn)) +#define __unused __attribute__((unused)) +#define __printf(x, y) __attribute__((format(printf, (x), (y))))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -95,9 +95,9 @@ extern char *xstrdup(const char *s); extern int strtoul_ui(char const *s, int base, unsigned int *result); extern int strtol_i(char const *s, int base, int *result);
-extern void die(const char *err, ...) __format __noreturn; -extern void die_errno(const char *fmt, ...) __format __noreturn; -extern void error(const char *err, ...) __format; +extern void die(const char *err, ...) __noreturn __printf(1,2); +extern void die_errno(const char *fmt, ...) __noreturn __printf(1,2); +extern void error(const char *err, ...) __printf(1,2);
static inline char *skip_whitespace(char *str) { diff --git a/src/tui/msgboxes.h b/src/tui/msgboxes.h index 9758411..69336fe 100644 --- a/src/tui/msgboxes.h +++ b/src/tui/msgboxes.h @@ -6,7 +6,7 @@ void tx_init_error_attrs(int border, int text, int prompt); void tx_init_info_attrs(int border, int text, int prompt); void tx_infobox(char *text, char *prompt); -void tui_error(const char *prompt, const char *err, ...) __attribute((format (printf, 2, 3))); +void tui_error(const char *prompt, const char *err, ...) __printf(2,3); void tui_error_va(const char *prompt, const char *err, va_list vararg);
#endif /* IPTRAF_NG_TUI_MSGBOXES_H */
Vitezslav Samel vitezslav@samel.cz writes:
Vitezslav Samel (3): packet.c: do not poll() for key press when not needed usage.c: fix spelling (*_buildin() --> *_builtin()) define __attribute__((format(printf, x, y))) as __printf(x,y)
src/error.h | 2 +- src/iptraf-ng-compat.h | 12 ++++++------ src/packet.c | 2 +- src/tui/msgboxes.h | 2 +- src/usage.c | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-)
applied. thanks.
iptraf-ng@lists.fedorahosted.org