]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
treewide: use configured value as the default color output
authorAndrea Claudi <aclaudi@redhat.com>
Wed, 13 Sep 2023 17:58:26 +0000 (19:58 +0200)
committerDavid Ahern <dsahern@kernel.org>
Thu, 14 Sep 2023 15:20:26 +0000 (09:20 -0600)
With Makefile providing -DCONF_COLOR, we can use its value as the
default color output.

This effectively allow users and packagers to define a default for the
color output feature without using shell aliases, and with minimum code
impact.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
bridge/bridge.c
ip/ip.c
tc/tc.c

index 704be50c70b30e6d1e19b18b7b85c0981e6224ff..339101a874b1bc540485a8380b4204b5c1e4dbc0 100644 (file)
@@ -23,7 +23,6 @@ int preferred_family = AF_UNSPEC;
 int oneline;
 int show_stats;
 int show_details;
-static int color;
 int compress_vlans;
 int json;
 int timestamp;
@@ -103,6 +102,8 @@ static int batch(const char *name)
 int
 main(int argc, char **argv)
 {
+       int color = CONF_COLOR;
+
        while (argc > 1) {
                const char *opt = argv[1];
 
diff --git a/ip/ip.c b/ip/ip.c
index 8c046ef1df1438b63c764c7b38b13f31f9d6c3dd..860ff957c3b3d91bc48d177c71fe9a4001742988 100644 (file)
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
        const char *libbpf_version;
        char *batch_file = NULL;
        char *basename;
-       int color = 0;
+       int color = CONF_COLOR;
 
        /* to run vrf exec without root, capabilities might be set, drop them
         * if not needed as the first thing.
diff --git a/tc/tc.c b/tc/tc.c
index 258205004611c4a131b7370272d2cdf2c8ad42e2..082c6677d34aea8dfcceb73cbb1ec4d9d59b522c 100644 (file)
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -35,7 +35,6 @@ int use_iec;
 int force;
 bool use_names;
 int json;
-int color;
 int oneline;
 int brief;
 
@@ -254,6 +253,7 @@ int main(int argc, char **argv)
 {
        const char *libbpf_version;
        char *batch_file = NULL;
+       int color = CONF_COLOR;
        int ret;
 
        while (argc > 1) {