diff options
author | Karel Zak | 2013-07-01 11:29:06 +0200 |
---|---|---|
committer | Karel Zak | 2013-07-01 11:29:06 +0200 |
commit | 15a1e371682269fbfed2674cc2d76725ae3ca731 (patch) | |
tree | 82d72f33abfacb1a99919c8fa3b3c407f01cd34c /sys-utils/dmesg.c | |
parent | dmesg: fix --human color initialization (diff) | |
download | kernel-qcow2-util-linux-15a1e371682269fbfed2674cc2d76725ae3ca731.tar.gz kernel-qcow2-util-linux-15a1e371682269fbfed2674cc2d76725ae3ca731.tar.xz kernel-qcow2-util-linux-15a1e371682269fbfed2674cc2d76725ae3ca731.zip |
dmesg: define is_timefmt() macro only once
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r-- | sys-utils/dmesg.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 2a28b6b74..c098323c2 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -136,7 +136,7 @@ enum { DMESG_TIMEFTM_TIME_DELTA, /* [time <delta>] */ DMESG_TIMEFTM_ISO8601 /* 2013-06-13T22:11:00,123456+0100 */ }; -#define is_timefmt(c, f) (c->time_fmt == (DMESG_TIMEFTM_ ##f)) +#define is_timefmt(c, f) ((c)->time_fmt == (DMESG_TIMEFTM_ ##f)) struct dmesg_control { /* bit arrays -- see include/bitops.h */ @@ -1157,8 +1157,6 @@ static int which_time_format(const char *optarg) errx(EXIT_FAILURE, _("unknown time format: %s"), optarg); } -#undef is_timefmt -#define is_timefmt(c, f) (c.time_fmt == (DMESG_TIMEFTM_ ##f)) int main(int argc, char *argv[]) { char *buf = NULL; @@ -1337,7 +1335,10 @@ int main(int argc, char *argv[]) if (argc > 1) usage(stderr); - if (is_timefmt(ctl, RELTIME) || is_timefmt(ctl, CTIME) || is_timefmt(ctl, ISO8601)) { + if (is_timefmt(&ctl, RELTIME) || + is_timefmt(&ctl, CTIME) || + is_timefmt(&ctl, ISO8601)) { + ctl.boot_time = get_boot_time(); if (!ctl.boot_time) ctl.time_fmt = DMESG_TIMEFTM_NONE; @@ -1356,7 +1357,8 @@ int main(int argc, char *argv[]) } if (ctl.raw - && (ctl.fltr_lev || ctl.fltr_fac || ctl.decode || !is_timefmt(ctl, NONE))) + && (ctl.fltr_lev || ctl.fltr_fac || ctl.decode + || !is_timefmt(&ctl, NONE))) errx(EXIT_FAILURE, _("--raw can't be used together with level, " "facility, decode, delta, ctime or notime options")); |