From 8bcc74c9e79b06d06160ae0268eed78796e772d6 Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <gnu@gisladisker.se>
Date: Sun, 2 Aug 2015 00:57:04 +0200
Subject: [PATCH 09/60] ifconfig: Verbose report on changed flags.

---
 ChangeLog           |  8 ++++++++
 ifconfig/changeif.c | 24 ++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 557b7a9c..6c592b72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-08-02  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Verbose report on changed flags.
+
+	* ifconfig/changeif.c (set_flags): In verbose report mode,
+	compose a message to name those flags that were set, and
+	also those that were cleared.
+
 2015-08-01  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Apply flags correctly.
diff --git a/ifconfig/changeif.c b/ifconfig/changeif.c
index a040587b..beac6f6d 100644
--- a/ifconfig/changeif.c
+++ b/ifconfig/changeif.c
@@ -367,6 +367,30 @@ set_flags (int sfd, struct ifreq *ifr, int setflags, int clrflags)
       error (0, errno, "SIOCSIFFLAGS failed");
       return -1;
     }
+
+  if (verbose)
+    {
+      printf ("Setting %sflags", setflags ? "" : "no ");
+
+      if (setflags)
+	{
+	  printf (" `");
+	  print_if_flags (setflags, NULL, ',');
+	  putchar ('\'');
+	}
+
+      printf (" of `%s'", ifr->ifr_name);
+
+      if (clrflags)
+	{
+	  printf (", clearing `");
+	  print_if_flags (clrflags, NULL, ',');
+	  putchar ('\'');
+	}
+
+      printf (".\n");
+    }
+
   return 0;
 #endif
 }
-- 
2.26.0.292.g33ef6b2f38

