aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-03-02 14:10:28 -0600
committerRob Landley <rob@landley.net>2020-03-02 14:10:28 -0600
commit709e13af3a654e75c3cdea04f53c1aca09b9543b (patch)
tree8b01644a7826920fc62a9f89c66b34fccfc3196f
parent4815b4f35f272ee3a4f8ac13adb5bd5dfc8ff4a6 (diff)
downloadtoybox-709e13af3a654e75c3cdea04f53c1aca09b9543b.tar.gz
Switch to FLAG() macros.
-rw-r--r--toys/lsb/dmesg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/toys/lsb/dmesg.c b/toys/lsb/dmesg.c
index a55dabf5..829fcd54 100644
--- a/toys/lsb/dmesg.c
+++ b/toys/lsb/dmesg.c
@@ -69,15 +69,15 @@ static void format_message(char *msg, int new)
subsystem = p ? (p-text) : 0;
// To get "raw" output for /dev/kmsg we need to add priority to each line
- if (toys.optflags&FLAG_r) {
+ if (FLAG(r)) {
color(0);
printf("<%d>", facpri);
}
// Format the time.
- if (!(toys.optflags&FLAG_t)) {
+ if (!FLAG(t)) {
color(32);
- if (toys.optflags&FLAG_T) {
+ if (FLAG(T)) {
time_t t = TT.tea+time_s;
char *ts = ctime(&t);
@@ -115,23 +115,23 @@ void dmesg_main(void)
if (TT.use_color) sigatexit(dmesg_cleanup);
// If we're displaying output, is it klogctl or /dev/kmsg?
- if (toys.optflags & (FLAG_C|FLAG_n)) goto no_output;
+ if (FLAG(C)||FLAG(n)) goto no_output;
- if (toys.optflags&FLAG_T) {
+ if (FLAG(T)) {
struct sysinfo info;
sysinfo(&info);
TT.tea = time(0)-info.uptime;
}
- if (!(toys.optflags&FLAG_S)) {
+ if (!FLAG(S)) {
char msg[8193]; // CONSOLE_EXT_LOG_MAX+1
ssize_t len;
int fd;
// Each read returns one message. By default, we block when there are no
// more messages (--follow); O_NONBLOCK is needed for for usual behavior.
- fd = open("/dev/kmsg", O_RDONLY|(O_NONBLOCK*!(toys.optflags&FLAG_w)));
+ fd = open("/dev/kmsg", O_RDONLY|(O_NONBLOCK*!FLAG(w)));
if (fd == -1) goto klogctl_mode;
// SYSLOG_ACTION_CLEAR(5) doesn't actually remove anything from /dev/kmsg,
@@ -158,7 +158,7 @@ klogctl_mode:
// Figure out how much data we need, and fetch it.
if (!(size = TT.s)) size = xklogctl(10, 0, 0);
data = from = xmalloc(size+1);
- data[size = xklogctl(3+(toys.optflags&FLAG_c), data, size)] = 0;
+ data[size = xklogctl(3+FLAG(c), data, size)] = 0;
// Send each line to format_message.
to = data + size;
@@ -174,8 +174,8 @@ klogctl_mode:
no_output:
// Set the log level?
- if (toys.optflags & FLAG_n) xklogctl(8, 0, TT.n);
+ if (FLAG(n)) xklogctl(8, 0, TT.n);
// Clear the buffer?
- if (toys.optflags & (FLAG_C|FLAG_c)) xklogctl(5, 0, 0);
+ if (FLAG(C)||FLAG(c)) xklogctl(5, 0, 0);
}