Mercurial > hg > toybox
comparison toys/lsb/dmesg.c @ 674:7e846e281e38
New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 08 Oct 2012 00:02:30 -0500 |
parents | 6df4ccc0acbe |
children | 786841fdb1e0 |
comparison
equal
deleted
inserted
replaced
673:c102f31a753e | 674:7e846e281e38 |
---|---|
19 -n Set kernel logging level (1-9). | 19 -n Set kernel logging level (1-9). |
20 -s Size of buffer to read (in bytes), default 16384. | 20 -s Size of buffer to read (in bytes), default 16384. |
21 -c Clear the ring buffer after printing. | 21 -c Clear the ring buffer after printing. |
22 */ | 22 */ |
23 | 23 |
24 #define FOR_dmesg | |
24 #include "toys.h" | 25 #include "toys.h" |
25 #include <sys/klog.h> | 26 #include <sys/klog.h> |
26 | 27 |
27 DEFINE_GLOBALS( | 28 GLOBALS( |
28 long level; | 29 long level; |
29 long size; | 30 long size; |
30 ) | 31 ) |
31 | |
32 #define TT this.dmesg | |
33 | 32 |
34 void dmesg_main(void) | 33 void dmesg_main(void) |
35 { | 34 { |
36 // For -n just tell kernel to which messages to keep. | 35 // For -n just tell kernel to which messages to keep. |
37 if (toys.optflags & 2) { | 36 if (toys.optflags & 2) { |