couple of trivial patches

Philip Blundell pb@nexus.co.uk
19 Jun 2003 19:53:29 +0100


--=-2vgmuaY3tcZzE4xqUJxk
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I just noticed that both dbus-send and dbus-monitor only accept
"--system" as an argument, contrary to what their usage messages might
have you believe.

Also, dbus-print-message.c didn't understand BOOLEAN values.

Patch is attached.

p.


--=-2vgmuaY3tcZzE4xqUJxk
Content-Disposition: attachment; filename=diff
Content-Type: text/plain; name=diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

2003-06-19  Philip Blundell  <philb@gnu.org>

	* tools/dbus-print-message.c (print_message): Handle BOOLEAN.

	* tools/dbus-send.c: Accept both --system and --session.
	* tools/dbus-monitor.c: Same here.

Index: tools/dbus-monitor.c
===================================================================
RCS file: /freedesktop/dbus/tools/dbus-monitor.c,v
retrieving revision 1.6
diff -u -p -r1.6 dbus-monitor.c
--- tools/dbus-monitor.c	28 May 2003 21:26:03 -0000	1.6
+++ tools/dbus-monitor.c	19 Jun 2003 18:34:54 -0000
@@ -46,7 +46,7 @@ handler_func (DBusMessageHandler *handle
 static void
 usage (char *name, int ecode)
 {
-  fprintf (stderr, "Usage: %s [--system]\n", name);
+  fprintf (stderr, "Usage: %s [--system | --session]\n", name);
   exit (ecode);
 }
 
@@ -66,6 +66,8 @@ main (int argc, char *argv[])
 
       if (!strcmp (arg, "--system"))
 	type = DBUS_BUS_SYSTEM;
+      else if (!strcmp (arg, "--session"))
+	type = DBUS_BUS_SESSION;
       else if (!strcmp (arg, "--help"))
 	usage (argv[0], 0);
       else if (!strcmp (arg, "--"))
Index: tools/dbus-print-message.c
===================================================================
RCS file: /freedesktop/dbus/tools/dbus-print-message.c,v
retrieving revision 1.1
diff -u -p -r1.1 dbus-print-message.c
--- tools/dbus-print-message.c	16 May 2003 20:09:25 -0000	1.1
+++ tools/dbus-print-message.c	19 Jun 2003 18:34:54 -0000
@@ -43,6 +43,7 @@ print_message (DBusMessage *message)
       dbus_int32_t int32;
       double d;
       unsigned char byte;
+      dbus_bool_t boolean;
 
       if (type == DBUS_TYPE_INVALID)
 	break;
@@ -72,6 +73,11 @@ print_message (DBusMessage *message)
 	case DBUS_TYPE_BYTE:
 	  byte = dbus_message_iter_get_byte (&iter);
 	  printf ("byte:%d\n", byte);
+	  break;
+
+	case DBUS_TYPE_BOOLEAN:
+	  boolean = dbus_message_iter_get_boolean (&iter);
+	  printf ("boolean:%d\n", boolean);
 	  break;
 
 	default:
Index: tools/dbus-send.c
===================================================================
RCS file: /freedesktop/dbus/tools/dbus-send.c,v
retrieving revision 1.4
diff -u -p -r1.4 dbus-send.c
--- tools/dbus-send.c	18 May 2003 02:39:47 -0000	1.4
+++ tools/dbus-send.c	19 Jun 2003 18:34:54 -0000
@@ -30,7 +30,7 @@
 static void
 usage (char *name, int ecode)
 {
-  fprintf (stderr, "Usage: %s [--help] [--session] [--dest=SERVICE] [--print-reply] <message type> [contents ...]\n", name);
+  fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--print-reply] <message type> [contents ...]\n", name);
   exit (ecode);
 }
 
@@ -58,6 +58,8 @@ main (int argc, char *argv[])
 
       if (strcmp (arg, "--system") == 0)
 	type = DBUS_BUS_SYSTEM;
+      else if (strcmp (arg, "--session") == 0)
+	type = DBUS_BUS_SESSION;
       else if (strcmp (arg, "--print-reply") == 0)
         print_reply = TRUE;
       else if (strstr (arg, "--dest=") == arg)

--=-2vgmuaY3tcZzE4xqUJxk--